Navigation

Upgrading Mongoid

Upgrading to 7.x Series

This major version of Mongoid has a number of significant refactors, bug fixes and behavior corrections.

Please see the list of behavior changes for version 7.0.0 and version 7.0.0.beta for specific changes that might be required in your code.

Upgrading to 6.x Series

Mongoid 6.x is compatible with Rails 5 and requires Ruby 2.2.2 or higher.

Please see the list of behavior changes for version 6.0.0.rc0 and version 6.0.0.beta for specific changes that might be required in your code.

Upgrading to 5.x Series

The underlying driver has changed from Moped to the official MongoDB Ruby driver. For all users dropping down to the driver level for operations, please see the driver documentation for help with that API.

All Mongoid configuration options have changed, as the underlying driver has changed from Moped to the official MongoDB Ruby driver. Please see the configuration section for a detailed description of all the new options.

All references to session are now replaced with client. This includes the mongoid.yml configuration, store_in options, and all exceptions and modules with Session in the name.

find_and_modify has been removed and replaced with 3 options: find_one_and_update, find_one_and_delete and find_one_and_replace.

text_search has been removed as it is now a $text option in a query from MongoDB 2.6 onward.

first and last no longer add an _id sort when no sorting options have been provided. In order to guarantee that a document is the first or last, it needs to now contain an explicit sort.

Mongoid 5.x supports MongoDB 2.4 and higher only - MongoDB 2.2 is no longer supported.