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

IgnoreIfDefault not working?

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.10.2
    • Component/s: BSON
    • Labels:
      None
    • Environment:
      Windows 10

      Setting IgnoreIfDefault to true through the BsonClassMap.RegisterClassMap call does not seem to work.

      Eg:

      doc.MapMember(x => x.TriesDone).SetIgnoreIfDefault(true);
      

      TriesDone gets serialized to the database with a default value of 0. I am having the same issue with reference types set to null.

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            brecht.vanhaesebrouck@sea-invest.com Brecht Vanhaesebrouck
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: