View on GitHub


Test Coverage

.. default-domain:: mongodb

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


Please see the :ref:`compatibility <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 :ref:`TLS compatibility <tls-compatibility>`
section provides further details on usage of newer TLS protocols like TLS 1.1.

.. _installation:

Install the Gem

Add ``mongo`` to your ``Gemfile``:

.. code-block:: ruby

  gem "mongo", "~> 2"

To install the driver manually:

.. code-block:: sh

  gem install mongo -v '~> 2'

What's New

Please see the :ref:`release notes <release-notes>` for the major changes
in each driver release and the `releases page on GitHub
<>`_ for the complete
list of changes for each release of the driver.