This project has moved and is read-only. For the latest updates, please go here.

Adding entity with SafeMode.True?

May 1, 2012 at 6:25 PM

Is there a plan to extend Add method with SafeMode options?  

Insert by default does not check whether the document was inserted which is awkward if there is any unique index in place. Solution is to use safe index, or in other words use insert with SafeMode.True.

May 1, 2012 at 9:26 PM
Edited May 2, 2012 at 12:55 AM

That would "leak" Mongo-specific implementation details to the repository abstraction; you should (or could) use the connectionstring setting:

?safe=true

To quote that page:

You should almost always add "safe=true" to your connection string. 

That should work for you. Note that our documentation also points that out (albeit a little obscured):

More on connectionstrings can be found herePay particular attention to the "?safe=true" option.