FilteredMongoCollectionBase.FindOneAndUpdate throws NullReferenceException when options is null

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Unknown
    • 3.10.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Fully Compatible
    • Dotnet Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • 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.

            Assignee:
            Ferdinando Papale
            Reporter:
            flibustier seas
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: