-
Type: Improvement
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 1.3.1
-
Component/s: None
-
None
-
Major Change
The constructors for MongoInsertOptions and MongoUpdateOptions take a collection parameter for the purpose of inheriting some of the values from the collection. But this results in having to specify the collection twice in code like the following:
var options = new MongoInsertOptions(collection) { SafeMode = SafeMode.W2 }; collection.Insert(document, options);
It would be nicer (and shorter) to just write:
var options = new MongoInsertOptions { SafeMode = SafeMode.W2 }; // no collection parameter collection.Insert(document, options);
This does mean that the options class will NOT be filled in with default values from the collection, so the properties of the options class will be null unless set to a value by your code. The collection class will know to fetch default values from the collection for any values to explicitly set in the options class.