Atomic update (Set) not work if object value null

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Minor - P4
    • 1.4
    • Affects Version/s: 1.3
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • 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 Stam
              Reporter:
              Andrew Orsich
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: