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

BsonDocument which is null actually create an object with one name-value pair

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 2.1
    • Fix Version/s: None
    • Component/s: Serialization
    • Labels:
    • Environment:
      windows 7 64 bit WiredTiger engine

      Description

      If I create a property in a class like:

      public class User
      {
          public string Id { get; set; }
          public BsonDocument UserSettings { get; set; }  
          .....
      }
      

      If the UserSettings is null when a new document is inserted then the driver actually creates a bson document with one name-value pair like that:

      "userSettings" : {
          "_csharpnull" : true
      },
      

      That looks strange to me since i expected that property to be null like that:

      "userSettings" : null,
      

      Am I missing something?

      Thanks,
      Itzik

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              itzikkg Itzhak Kagan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: