Another Database Option - MongoDB
It’s been far to long since I’ve talked here about what I’m working on, so it is time to correct that. I’ve been working with a client who has some very unique business requirements, and one of them deals with a lot of flexibility of their data storage. As such we were looking into different types of storage, because while SQL Server is in fact a wonderful product, it is not known for its flexibility of storage.
This quest led us to the door of a large number of databases in the “No SQL” arena, and eventually to MongoDB. MongoDB is a document database, which stores what can best be described to the .NET Developer as a Dictionary<string,object>. This structure allows for nesting of structures (where the object stored is another Dictionary) and is a very clever structure if you ask me. But, document databases do not work like relational databases. There are several important things you need to realize:
- Documents databases do not generally support the concept of JOINS. If you retrieve data, and it refers to other data, then you need to make another call to the database to retrieve that data.
- This leads to the core concept of preferring to embed (in the dictionary) data rather than refer to data.
In the world of .NET there are several drivers, but the one my team, David O’Hara and Craig Neuwirt and I, decided on was MongoDB-CSharp. They have just released version 0.9 beta 1, which moves the driver a lot closer to a familiarity level for most .NET developers. Now we had to address on our project all of the above problems, and key to us doing so has been a component called DictionaryAdapater from the Castle Project. But that is a topic for another blog post.