My Month of New Technology

I'm David Eisinger, and I'm learning a new technology every day for a month.

Day 19: MongoDB

Last night, Ren and I checked out MongoDB, a document-oriented database that claims to bridge the gap between key-value stores and traditional RDBMSes. Mongo is one of the technologies at the forefront of the NoSQL movement — which, in a nod to political correctness, apparently now stands for “not only SQL” — and has been getting a lot of good press in the Ruby on Rails community. This post by John Nunemaker, for one, served as a call to action to many Ruby devs that it might be time to step away from the typical MySQL-backed app.

Both Ren and I had tried Mongo before last night, though for me, it was only in the context of Nunemaker’s MongoMapper, a library for storing Ruby objetcs in Mongo. We decided to start from scratch, firing up the interactive console and working through the tutorial. About midway through the tutorial, it became clear that the shell was actually a Javascript interpreter, which blew my mind in a small way, if that’s possible. It turns out that Mongo uses Javascript not only to format data, but to interact with it. I think this will help Mongo’s uptake, as it shortens the learning curve considerably.

After working through the basic examples, I decided to investigate how to write complex queries against Mongo. The official docs were somewhat obtuse, but this post by Kyle Banker proved to be much more helpful. In fact, it’s the last of a series of three very well-written posts. All highly recommended. Ren took a look at GridFS, Mongo’s solution for storing large chunks of binary data. I’m still not sold on it as a solution for storing uploads; you’ve long been able to store binary data in an RDBMS, but it turns out that we already have a great system for storing files … the filesystem.

MongoDB is clearly awesome, and I’m glad to have a better sense of its internals. I’ll be on the lookout for a project where a document-oriented database seems appropriate. I wonder if the changes to ActiveRecord in Rails 3 will bring SQL back into vogue or if more and more devs will make the jump.