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

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

    XMLWordPrintable

    Details

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

      Description

      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

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: