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

Updating non-null dictionary field with null doesn`t work

    • Type: Icon: Bug Bug
    • Resolution: Gone away
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.10.4
    • Component/s: Serialization
    • Labels:
      None
    • Environment:
      .Net Core 3.1

      I have such field in Document

      [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
      public Dictionary<LinkAt<AdvertType>, decimal> AdvertisementTypeAndPrice { get; set; }

      LinkAt is Document too

      now this field is not null, exactly it has 3 keyvalue pairs

      but when i try to do this code
      acc.AudienceGroupPercentage = null;
      acc.Save();

       

      it doesnt saves. No exeption, but if i am trying to get this object another one time, i get the start value with 3 keyvalue pairs.

       

      Found this issue in google, but it is not related to C# and mongo driver exactly, but may be helpfull
      https://github.com/doctrine/mongodb-odm/issues/1671

            Assignee:
            Unassigned Unassigned
            Reporter:
            a.pchelkin32@gmail.com Aleksandr N/A
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: