Litedb : Convert string to BsonDocument and vice-versa

459 views Asked by At

When i convert bson to string using the following :

var stringDoc = LiteDB.JsonSerializer.Serialize(bsonDocument);

i'm getting the following :

{"_id":{"$oid":"62f3c9299c37811224131269"},"Name":"John Doe","Phone":"0778636316"}

When i try to convert back to bsonDocument using the following instruction :

BsonDocument bsonDocument = BsonMapper.Global.ToDocument(stringDoc);

I'm getting null in the bsonDocument variable.

0

There are 0 answers