Docs Menu

Docs HomeMongoid


On this page

  • Install the Gem
  • Using Mongoid with a New Rails Application
  • Using Mongoid with an Existing Rails Application

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', '~> 9.0.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.

←  Installation & ConfigurationCompatibility →
Share Feedback
© 2023 MongoDB, Inc.


  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2023 MongoDB, Inc.