c# - Convert string into MongoDB BsonDocument -


i have long string in json format, , want convert bsondocument insertion mongodb database. how do conversion? i'm using official c# driver.

the answer is:

string json = "{ 'foo' : 'bar' }"; mongodb.bson.bsondocument document     = mongodb.bson.serialization.bsonserializer.deserialize<bsondocument>(json); 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -