Learn the "why" behind slow queries and how to fix them in our 2-Part Webinar.
Register now >
Docs Menu
Docs Home
/ /

Mongoid: The ODM for MongoDB in Ruby

Welcome to the documentation site for Mongoid. Mongoid is the officially supported object-document mapper (ODM) for MongoDB in Ruby. By using Mongoid, you can easily interact with your data and create flexible data models native to Ruby applications.

You can add Mongoid to your Ruby application to connect it to a MongoDB database. Install Mongoid by adding it to your project's Gemfile or set up a runnable project by following one of the Quick Start guides.

Learn how to establish a connection to MongoDB Atlas and begin working with data by following one of the following guides:

  • Integrate Mongoid with Ruby on Rails

  • Integrate Mongoid with Sinatra

You can use Mongoid to connect to MongoDB deployments running on one of the following hosted services or editions:

  • MongoDB Atlas: the fully managed service for MongoDB deployments in the cloud

  • MongoDB Enterprise: the subscription-based, self-managed version of MongoDB

  • MongoDB Community: the source-available, free-to-use, and self-managed version of MongoDB

To learn how to configure your MongoDB connection, see the Connect to MongoDB section.

To learn how to use Mongoid to interact with your MongoDB data, see the Interact with Data section.

To learn how to model your MongoDB data as Mongoid models, see the Model Data section.

To learn how to secure your data by using encryption, see the In-Use Encryption section.

To learn how to use Mongoid alongside other libraries and frameworks, see the Third-Party Integrations section.

To learn about the versions of MongoDB Server, the Ruby language, the Ruby driver, and Ruby on Rails framework that are compatible with each version of Mongoid, see the Compatibility page.

To view a list of new features and changes in each version, see the Release Notes section.

To find resources for troubleshooting and to learn about contributing to Mongoid, see Issues & Help.

Next

Get Started: Ruby on Rails