Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions src/_posts/languages/ruby/2000-01-01-mongoid.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
---
title: Configure Mongoid
nav: Mongoid
modified_at: 2023-12-22 00:00:00
modified_at: 2026-05-18 00:00:00
tags: ruby mongoid mongodb
---

{% warning %}
Use the MongoDB Ruby driver `mongo` up to version `2.23.0` when connecting to
MongoDB Server `3.6` or `4.0`.
{% endwarning %}

You need to create the file `config/mongoid.yml` in order to configure Mongoid:

```yaml
Expand All @@ -20,6 +25,28 @@ production:
uri: <%= ENV['SCALINGO_MONGO_URL'] %>
```

Add the `mongo` gem to your `Gemfile`:

```ruby
gem 'mongo', '2.23.0'
```


## Connection Options

If you want to modify connection options or the connections pooling, you can
find all the information in the [official
documentation](https://www.mongodb.com/docs/mongoid/current/installation/).
find all the information in the [official documentation][mongoid-documentation].


## MongoDB Ruby Driver Compatibility

Scalingo for MongoDB® supports MongoDB up to version `4.0.3`, the latest version available under AGPL 3.0.

The Mongo Ruby driver `mongo` version `2.24.0` removed support for MongoDB
Server `3.6` and `4.0`. As a consequence, **Ruby applications using MongoDB on
Scalingo must pin the `mongo` gem to version `2.23.0` or lower.**

For more information, see the [MongoDB Ruby Driver release notes][ruby-driver-release-notes].

[ruby-driver-release-notes]: https://www.mongodb.com/docs/ruby-driver/current/reference/release-notes/#std-label-ruby-version-2.23
[mongoid-documentation]: https://www.mongodb.com/docs/mongoid/current/