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

FindOneAndUpdateAsync with empty update definition erases document fields

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.2.4
    • Affects Version/s: 2.0
    • Component/s: Operations
    • Labels:
      None

      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.

      Unable to find source-code formatter for language: cs. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      var updates = new List<UpdateDefinition<Region>>();
      _collection.FindOneAndUpdateAsync(filter, Builders<Region>.Update.Combine(updates), new FindOneAndUpdateOptions<Region>
                      {
                          ReturnDocument = ReturnDocument.After,
                      });
      

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

              Created:
              Updated:
              Resolved: