Working with MongoDB Conventions
Posted by: K. Scott Allen,
on 08 Mar 2012 |
View original | Bookmarked: 0 time(s)
I started working with Mongo again recently and needed to fiddle a bit to retrieve existing data using the official 10gen driver. Let's say you have the following persisted in a Mongo collection: {
"_id": ObjectId("4efa88..."),
"first_name": "Scott"
};
The driver will happily work with an object of the following type using the default mapping conventions.
public class Person
{
public ObjectId _id { get; set; }
public string first_name { get; set; }
}
Of course, the C# class...