Object Mappers for Ruby and MongoDB

Although it's possible to use the Ruby driver by itself, sometimes you want validations, associations, and many of the other conveniences provided by ActiveRecord. Here, then, is a list of the most popular object mappers available for working with Ruby and MongoDB.

Recommendations

Just for the record, 10gen doesn't recommend any one object mapper over the others. What we do advise is that you get to know how the database itself works. This is best accomplished by playing with the shell and experimenting with the Ruby driver (or any of the other drivers, for that matter).

Once you understand how MongoDB works, you'll be in a good position to choose the object mapper that best suits your needs. Certainly so long as you pick an OM that's used in production and is actively developed, you really can't make a bad choice.

Libraries

MongoMapper

John Nunemaker's OM. Used in production and actively-developed. ActiveModel support forthcoming.

Installation:

  • gem install mongo_mapper

Source:

Documentation:

Articles:

Mongoid

Durran Jordan's OM. Used in production and actively-developed. Supports ActiveModel and Rails 3.

Installation:

  • gem install mongoid

Source:

Documentation:

MongoRecord

10gen's original OM.

Notes:
MongoRecord is an ActiveRecord-like OM, and the first of its kind developed for MongoDB. Favored by a contingent of developers for its simplicity, MongoRecord currently receives a lot of love from Nate Wiger.

Installation:

  • gem install mongo_record

Source:

MongoDoc

Les Hill's OM. Currently alpha but actively-developed.

Notes:

MongoDoc is optimized for speed and simplicity. Originally built as a BSON library that worked like Ruby's JSON gem, MongoDoc has grown into its own OM.

Installation:

  • gem install mongodoc

Source:

MongoModel

Sam Pohlenz's OM. Actively-developed.

Notes:

An OM with emphaisis on ActiveModel compatibility.

Installation:

  • gem install mongomodel

Source:


Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

IF YOU HAVE A QUESTION, POST IT TO THE USER GROUP.

These pages are fine for comments, but for questions, your best bet will always be the MongoDB User Group.

blog comments powered by Disqus