Here’s a quick little demo of the NoSQL database MongoDB. The intent is to give a .NET user just enough info to get started. To whet the appetite and hopefully spark some interest in trying it out. It was the start in our journey to decide to use MongoDB. BTW, the video is rushed, I’m talking and moving fast. The idea is to not waste your time. If you need it slower, that’s what <pause> is for.
This intro video covers:
- Client Commands, directly executing a few commands against Mongo using its client
- .NET Connection, creating a connecting in .NET and saving a new model to the database
- Model Flexibility, a practical example of growing the data model, without making scheme changes, and using both SQL and Mongo together
Here is the code used: mongodb-intro-stuff.7z
Some Points: its super easy to get started with; data stored is structured data, apparently a common misconception; you can query into fields inside a document; each entry contains its scheme with it; instead of flat tables, docs can be entire trees; it is free; read/writes are very fast; it assumes disk and memory storage are far more available than in the days of relational databases and so utilizes them heavily; companies are using it; there is a way to put SQL access on top; and like the Honey Badger, Mongo just don’t care.
Update (2/1/2012): For us .NET people, it essentially lets you worry about schema in one place, your code’s domain object model, instead of in two or three places: in code, in SQL, and possibly in the ORM. There is schema stored in the database, it’s just defined by and stored with the data instead of maintaining a separate DB schema like with SQL. This makes adding new fields, combining object entities into natural tree structures, optimizing for speed, and dev to production migrations, hopefully easier. It doesn’t solve everything. Of course UI updates, field refactoring (moving fields across entities), etc are still involved updates, as they would be with SQL.
Update (2/19/2013): Mongo uses disk space like crazy. An ‘empty’ database may allocate 64MB of disk space and it grows real fast. This is because Mongo was built in modern times when disk space is a relatively inexpensive resource. It is also a more efficient way to grow performance than increasing CPU and memory, which are more classic solutions for improving SQL DB performance. And of course the disk space used is configurable. Think of it this way, if 10 million UserLogin objects takes 24GB (using MongoDB defaults), you could store 2.5 trillion records for $420 on 6GB using a 3x3TB RAID5 drives. It’d be incredibly fast and inexpensive to expand. Quite clever I think.