You are looking at the docs for v4.x. You can check out this page for Mongoid v3.x if you haven't upgraded yet.
Mongoid (pronounced mann-goyd) is an Object-Document-Mapper (ODM) for MongoDB written in Ruby. It was conceived in August, 2009 during a whiskey-induced evening at the infamous Oasis in Florida, USA by Durran Jordan.
The philosophy of Mongoid is to provide a familiar API to Ruby developers who have been using Active Record or Data Mapper, while leveraging the power of MongoDB's schemaless and performant document-based design, dynamic queries, and atomic modifier operations.
|Mongoid supports MRI 1.9.3+, and JRuby 1.6.0+ in 1.9 mode. All code samples will use 1.9 syntax.|
class Artist include Mongoid::Document field :name, type: String embeds_many :instruments end class Instrument include Mongoid::Document field :name, type: String embedded_in :artist end syd = Artist.where(name: "Syd Vicious").between(age: 18..25).first syd.instruments.create(name: "Bass") syd.with(database: "bands", session: "backup").save!