Mapping C# object to BsonDocument
I'm not sure where are you stuck but try:
var brdDoc = new BrdUser ();brdDoc.UserNm = "invisible";brdDoc.EmailAdrs = "someone@womewhere.com";brdDoc.Questions = new []{ new Question{ Title = "Q", Desciption = "Question to ask" } };var bsonDocument = brdDoc.ToBsonDocument ();var jsonDocument = bsonDocument.ToJson ();Console.WriteLine (jsonDocument);
It will print:
{ "_id" : null, "username" : "invisible", "email" : "someone@womewhere.com", "Questions" : [{ "_id" : null, "title" : "Q", "desc" : "Question to ask" }] }