Mongo Mapper

Document

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
  timestamps!
end

Custom Connections

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

class MyModel
  include MongoMapper::Document

  connection Mongo::MongoClient.new('localhost', 27017)
  set_database_name "my_database"
end
Fork me on GitHub