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

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -