Configure Mongoid

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

development:
  sessions:
    default:
      database: my-ruby-app
      hosts:
        - localhost:27017
production:
  sessions:
    default:
      uri: <%= ENV['SCALINGO_MONGO_URL'] %>

Add the mongo gem to your Gemfile:

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.

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.


Suggest edits

Configure Mongoid

©2026 Scalingo