MongoDB Slides and Materials from RIAUnleashed 2010

Tuesday, November 16, 2010

Picture, if you will, a ColdFusion Structure. Perhaps it looks like this:

doc =
	{
		NAME = "Marc",
		SPOUSE = "Heather",
		KIDS = [
			{NAME="Alexis", AGE=7, HAIR="blonde", DESCRIPTION="crazy" },
			{NAME="Sidney", AGE=2, HAIR="dirty blonde", DESCRIPTION="ornery" }
		],
		BIKE = "Felt",
		LOVESSQL = true,
		LOVESMONGO = true,
		TS = now(),
		COUNTER = 1
	};

Now, imagine if you could save that struct, query for that struct, update that struct. Imagine if you had a whole database full of structs, and querying them was finger-snap fast. Imagine if the database they lived in could grow to sizes unmanageable in a relational database. Imagine if scalability were sane, and replication were a few commands.

This database exists today, and it’s called MongoDB. MongoDB is a Document-oriented database, like CouchDB. A major player in the so-called “NoSQL” database market, MongoDB is a pleasure to use, partly because it aims to bridge the gap between NoSQL and relational databases by providing ad-hoc query support similar to SQL while still giving you MapReduce which most Document-oriented datastores use as their main query mechanism.

I began working with MongoDB when I began at BAH in May, 2010. I was tasked with creating a system whose data model was rather heterogeneous. We modeled the system first in a relational database, and while the result was familiar, it was also the embodiment of the “Object-relational impedance mismatch” which developers have bemoaned since the onset of Object-relational mapping systems. Ideally, the heterogeneous data could be persisted directly, without splitting apart before storing and reassembling upon fetching.

With MongoDB, we were able to achieve such data persistence. Thanks to that experience, I continued to work with MongoDB, and this November I presented on the topic at RIAUnleashed in Boston. This was also the first public presentation demonstrating CFMongoDB, of which I and the rest of the team are becoming quite proud.

The slides and sample code are available here: http://bit.ly/mongodbriau. Enjoy!

1 comment:

Ben Nadel said...

Marc, it was a really good presentation, thanks! This whole "Co"-SQL stuff ;) is very cool. Having lived in a relational database world for so long, it's a bit hard to figure out where/when this can be best used. I look forward to playing around with it.