Welcome to MongoRecord

MongoRecord is an ActiveRecord-like framework for the 10gen Mongo database.

This document assumes you have read the Mongo documentation.

Installation

$ gem sources -a http://gems.github.com
$ sudo gem install mongodb-mongo-activerecord-ruby

MongoRecord depends on the Mongo Ruby Driver. Installing the MongoRecord gem will also install the Mongo Ruby Driver if you don’t have it already.

The source code is available at github.com/mongodb/mongo-ruby-driver. You can either clone the git repository or download a tarball or zip file. Once you have the source, you can use it from wherever you downloaded it or you can install it as a gem from the source by typing

$ gem build mongo-activerecord-ruby.gemspec
# ignore "WARNING:  no rubyforge_project specified"
$ sudo gem install mongo-activerecord-ruby-X.Y.Z.gem

…where X.Y.Z is the gem version number. Remember that you need the Mongo gem, too.

Getting Started

See the examples, read the MongoRecord::Base and MongoRecord::Cursor documentation, and look at tests/test_mongo.rb.

Persistence

You can use MongoRecord::Base or talk to the database (stored in the $db object) directly.

See MongoRecord::Base and MongoRecord::Cursor.

Logger

See MongoRecord::LogDevice. When running outside of the cloud (for example, during development), all log messages are echoed to $stderr which is normally the console.

To Do

  • DBRefs