Docs Menu

Installation

Mongoid is bundled as a gem, and is hosted on Rubygems. It can be installed manually or with bundler.

To install the gem manually:

gem install mongoid

To install the gem with bundler, include the following in your Gemfile:

gem 'mongoid', '~> 8.1.0'

When creating a new Rails application and wish to use Mongoid for data access, give the --skip-active-record flag to the rails new command to avoid depending on and configuring ActiveRecord..

When converting an existing Rails application to use Mongoid for data access, the config/application.rb file needs to be updated to remove the require 'rails/all' line and explicitly include the required frameworks (which could be all of the frameworks provided by Rails with the exception of ActiveRecord). Any references to ActiveRecord in files in the config directory and in the models also need to be removed.