The Ruby driver is released as a gem hosted on Rubygems.


Please see the compatibility page for the list of Ruby versions and MongoDB server versions that this release of the Ruby driver is compatible with.

The driver itself is written entirely in Ruby, however it depends on the bson library which includes a C extension for MRI and a compiled Java extension for JRuby. A working C compiler and Ruby development headers and libraries are required when installing on MRI. When installing on JRuby, JRE is sufficient because the bson gem includes the compiled extension.

Connecting to TLS-enabled MongoDB servers, using SCRAM authentication (both SCRAM-SHA-1 and SCRAM-SHA-256) and using X.509 authentication (which is performed over a TLS connection) requires the Ruby openssl extension to be present and working. The TLS compatibility section provides further details on usage of newer TLS protocols like TLS 1.1.

Install the Gem

Add mongo to your Gemfile:

gem "mongo", "~> 2"

To install the driver manually:

gem install mongo -v '~> 2'

What’s New

Please consult the releases page on GitHub for the list of improvements and changes in each version of the driver.