Created
April 22, 2013 20:32
-
-
Save beyond-code-github/5438273 to your computer and use it in GitHub Desktop.
Using the MongoDocument class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongoCollection = database.GetCollection<MongoDocument>("Dynamic"); | |
mongoCollection.Insert( | |
new MongoDocument( | |
new BsonDocument { | |
{ "Name", "A test record" }, | |
{ "Date", new DateTime(2013,01,01) }, | |
{ "Age", 28 }, | |
{ "Complete", false } })); | |
mongoCollection.Insert( | |
new MongoDocument( | |
new BsonDocument { | |
{ "Name", "Another test" }, | |
{ "Date", new DateTime(2013,02,02) }, | |
{ "Age", 36 }, | |
{ "Complete", true } })); | |
var result = mongoCollection.AsQueryable().Where(o => o["Name"] == "A test record").ToList(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment