-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
Dotnet Drivers
-
Not Needed
-
None
-
None
-
None
-
None
-
None
-
None
Summary
All four FindOneAndUpdate/FindOneAndUpdateAsync overloads in
FilteredMongoCollectionBase throw a NullReferenceException when the
options parameter is null (its default value).
How to Reproduce
var collection = database.GetCollection<Root>("test").OfType<Derived>();// options defaults to null → NullReferenceException collection.FindOneAndUpdate( Builders<Derived>.Filter.Eq(x => x.Id, "1"), Builders<Derived>.Update.Set(x => x.Name, "test"));// same for async await collection.FindOneAndUpdateAsync( Builders<Derived>.Filter.Eq(x => x.Id, "1"), Builders<Derived>.Update.Set(x => x.Name, "test"));
Additional Background
Please provide any additional background information that may be helpful in diagnosing the bug.