Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1597

FindOneAndUpdateAsync with empty update definition erases document fields

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.2.4
    • 2.0
    • Operations
    • None

    Description

      When calling FindOneAndUpdateOptions with update definition which is combination of items of update definitions list if the list is empty, then all document fields, except for id gets erased.

      var updates = new List<UpdateDefinition<Region>>();
      _collection.FindOneAndUpdateAsync(filter, Builders<Region>.Update.Combine(updates), new FindOneAndUpdateOptions<Region>
                      {
                          ReturnDocument = ReturnDocument.After,
                      });
      

      Attachments

        Activity

          People

            craig.wilson@mongodb.com Craig Wilson
            NickAb Nick Abalov [X]
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: