Skip to content

Instantly share code, notes, and snippets.

@hagbarddenstore
Created October 16, 2014 07:30
Show Gist options
  • Save hagbarddenstore/953448c4fdae64beea26 to your computer and use it in GitHub Desktop.
Save hagbarddenstore/953448c4fdae64beea26 to your computer and use it in GitHub Desktop.
/**
* Install-Package mongocsharpdriver
* Install-Package newtonsoft.json
*/
var document = new BsonDocument
{
{ "_id", Guid.NewGuid() },
{ "Name", "Hagbarddenstore" },
{
"Message", new BsonDocument
{
{ "_id", Guid.NewGuid() },
{ "CreatedOn", DateTime.UtcNow },
{ "Value", "Hello, world!" }
}
}
};
var dictionary = document.ToDictionary();
Console.WriteLine(JsonConvert.SerializeObject(dictionary, Formatting.Indented));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment