22 January 2010

MongoDB and Rails

I have been tinkering with MongoDB and the MongoMapper gem for Rails and creating a MongoDB-based Rails project is pretty easy.

Ryan Bates has an excellent screencast on using MongoMapper, although he doesn’t mention testing. Despite this, setting up a Cucumber -based test environment is possible as long as you are careful about how you do it. Ben Scofield has published a very helpful Application template and Nicolas Mérouze has recently written up his Machinist adapter for MongoDB.

However, testing is not all straight forward. If you want to use Pickle then you are currently out of luck, because pickle is dependent on ActiveRecord.

In fact, many Rails plugins depend on ActiveRecord and none of these will work with MongoMapper. I can’t use scaffolding and named scopes are not yet available either.

So, I am probably not quite ready to use MongoDB in my Rails applications yet. Maybe in a few months.

d. sofer