Convert string into MongoDB BsonDocument

后端 未结 3 955
误落风尘
误落风尘 2020-12-02 15:37

I have a long string in JSON format, and I want to convert it into a BSONDocument for insertion into a MongoDB database. How do I do the conversion? I\'m using the officia

3条回答
  •  孤城傲影
    2020-12-02 16:03

    string json = "{ 'foo' : 'bar' }";  
    BsonDocument document = BsonDocument.Parse(json);
    

提交回复
热议问题