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.
BsonDocument.ToDictionary converts an array of nested documents/arrays to an array of null values
- Assignee:
- Robert Stam
- Reporter:
- Daniel Goldman
- Votes:
-
0 Vote for this issue
- Watchers:
-
0 Start watching this issue
- Created:
- Updated:
- Resolved: