Mongo Mapper


Documents are first class citizens in MongoMapper. Out of the box you can persist them to collections and they can be related to other documents or embedded documents. They also come with all the typical dressings, such as associations, callbacks, serialization, validations, and rich querying.

class Article
  include MongoMapper::Document

  key :title,        String
  key :content,      String
  key :published_at, Time

Custom Connections

You override the Mongo connection or collection name for a model:

class MyModel
  include MongoMapper::Document

  connection'localhost', 27017)
  set_database_name "my_database"
Fork me on GitHub