My opinion on mappings for MongoDB

I think that enforcing mappings when using MongoDb is like taking a step towards an OR/M instead of away from it, and in my opinion: away is better. A strength with MongoDB is that it’s schema less, why then add fictive schemas by adding mappings in your C# code?

The driver I’m building uses Json.Net so that I can serialize/deserialize objects (anonymous types, static types, JSON-strings) back and forth between the DB and my conceptual model.

If you are using Sam Corders more mature C#-driver you migth wan’t to look at my earlier writings to get rid of manual mappings. You might also want to checkout Automapper to handle mappings with Dictionaries.

http://daniel.wertheim.se/2010/02/05/getting-started-with-mongodb-using-json-net-and-castle-dynamic-proxy/
http://daniel.wertheim.se/2010/02/07/mongodb-in-c-extensions-to-support-json-mapping-or-proxy-generation/
http://automapper.codeplex.com/

//Daniel

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s