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

BsonDocument.ToDictionary converts an array of nested documents/arrays to an array of null values

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 1.4.1
    • 1.3.1
    • None

    Description

      If a BsonDocument contains an array of nested documents or nested arrays, calling BsonDocument.ToDictionary will convert all of the array values to null. It looks like this occurs because BsonArray.CopyTo calls each of its elements' RawValue methods, which return null for BsonDocument and BsonArray instances. I've attached a CS file with new ToDictionary and helper methods that fix this error. At the bottom of the file is the test case I used to reproduce and then correct it.

      Attachments

        Activity

          People

            robert@mongodb.com Robert Stam
            dhgoldman Daniel Goldman
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: