Docs Menu

Compatibility

The following compatibility table specifies the versions of the Ruby driver that are compatible with each Mongoid version.

Note

Patch Version Compatibility

Older patch versions of Mongoid within the same minor release might support older Ruby driver versions. For example, Mongoid v7.0.5 supports Ruby driver v2.5 and later, but Mongoid v7.0.6 requires driver v2.7 or later.

Mongoid Version
Ruby Driver 2.18 to 2.21
Ruby Driver 2.10 to 2.17
Ruby Driver 2.7 to 2.9

8.0 to 9.0

The following compatibility table specifies the recommended version or versions of Mongoid that you can use with a specific version of MongoDB. To use features of a particular MongoDB Server version, both the Ruby driver and Mongoid must be compatible with that MongoDB version. To learn about the driver's MongoDB compatibility details, see Compatibility in the Ruby driver documentation.

The first column lists the version of Mongoid.

Important

MongoDB ensures compatibility between the MongoDB Server and the drivers for three years after the server version's end of life (EOL) date. To learn more about the MongoDB release and EOL dates, see MongoDB Software Lifecycle Schedules.

Icon
Explanation

All features are supported.

The Driver version will work with the MongoDB version, but not all new MongoDB features are supported.

No mark

The Driver version is not tested with the MongoDB version.

Mongoid Version
MongoDB 8.0
MongoDB 7.0
MongoDB 6.0
MongoDB 5.0
MongoDB 4.4
MongoDB 4.2
MongoDB 4.0
MongoDB 3.6

9.0

8.0 to 8.1

To learn more about how to read the compatibility tables, see the guide on MongoDB Compatibility Tables.

The following compatibility table specifies the recommended version or versions of Mongoid that you can use with specific Ruby interpreter versions.

The first column lists the version of Mongoid.

Mongoid Version
Ruby 3.2
Ruby 3.1
Ruby 3.0
Ruby 2.7
Ruby 2.6
Ruby 2.5
JRuby 9.4
JRuby 9.3
JRuby 9.2

9.0

8.1

8.0

To learn more about how to read the compatibility tables, see the guide on MongoDB Compatibility Tables.

The following compatibility table specifies which versions of Ruby on Rails are supported by Mongoid.

Mongoid Version
Rails 8.0
Rails 7.2
Rails 7.1
Rails 7.0
Rails 6.1
Rails 6.0
Rails 5.2
Rails 5.1

9.0

[1]

[2]

[3]

8.1

[1]

[2]

[3]

[4]

8.0

[3]

[4]

[1](1, 2) Rails 8.0 requires Mongoid v8.1.7 and v9.0.3 in the respective 8.1 and 9.0 stable branches.
[2](1, 2) Rails 7.2 requires Mongoid v8.1.6 and v9.0.2 in the respective 8.1 and 9.0 stable branches.
[3](1, 2, 3) Rails 7.1 requires Mongoid v8.0.7 or v8.1.3 in the respective 8.0 and 8.1 stable branches.
[4](1, 2) Using Rails 5.x with Ruby 3 is not supported.

Mongoid is compatible with many of the frameworks that comprise Ruby on Rails. In this section, you can learn about which frameworks you can use with Mongoid.

Mongoid attempts to offer API compatibility with Active Record, but libraries that depend directly on Active Record might not work as expected if you use Mongoid as a direct replacement.

Note

You can use Mongoid alongside Active Record within the same application.

Rails Framework
Mongoid Support
Notes

ActionCable

There is no MongoDB adapter for ActionCable, but you can use any existing adapter, such as the Redis Adapter, alongside Mongoid models.

ActionMailbox

Unsupported

Depends directly on Active Record.

ActionMailer

ActionPack

ActionText

Unsupported

Depends directly on Active Record.

ActionView

ActiveJob

Serialization of BSON and Mongoid objects works best if you explicitly send BSON::ObjectId values as strings, and reconstitute them in the job. For example:

record = Model.find(...)
MyJob.perform_later(record._id.to_s)
class MyJob < ApplicationJob
def perform(id_as_string)
record = Model.find(id_as_string)
# ...
end
end

ActiveModel

The Mongoid::Document module includes ActiveModel::Model and leverages ActiveModel::Validations for Document Validation.

ActiveStorage

Unsupported

Depends directly on Active Record.

ActiveSupport

The Mongoid module requires ActiveSupport. Mongoid uses ActiveSupport::TimeWithZone for handling time values.

If you have questions about compatibility, visit the following resources for further guidance: