BsonDocument
BsonDocument
is the default type used for documents. It handles dynamic documents of any complexity. For instance, the document { a: 1, b: [{ c: 1 }] }
can be built as follows:
var doc = new BsonDocument
{
{ "a", 1 },
{ "b", new BsonArray
{
new BsonDocument("c", 1)
}}
};
In addition, there is a Parse
method to make reading a JSON string simple.
var doc = BsonDocument.Parse("{ a: 1, b: [{ c: 1 }] }");
On this page