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

Atomic update (Set) not work if object value null

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.4
    • Affects Version/s: 1.3
    • Component/s: None

      Example:

      var message = new SomeClassWithFieldCode();
      //if code is null it will not update field, need to use BsonNull.Value in case if object value null
      var update = Update.Set("Code", message.Code); // Code is null
      mongoCollection.Update(Query.EQ("_id", message.Id), update);

      I suppose driver should replace null with BsonNull.Value internally rather than set it manually on each update in case if some property value equals to null.

      Thank you.

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            anorsich Andrew Orsich
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: