Docs Menu
Docs Home
/ / /
Ruby MongoDB Driver
/

Download and Install

1

Before you begin developing, ensure you install Ruby version 2.7 or later in your development environment. Ruby is pre-installed on macOS and some Linux distributions, but you might need to update your version.

Important

The Ruby driver is not officially supported on Windows.

2

Run the following command in your shell to create a directory called ruby-quickstart for this project:

mkdir ruby-quickstart

Then, run the following commands to create a quickstart.rb file in the ruby-quickstart directory:

cd ruby-quickstart
touch quickstart.rb
3

Open the quickstart.rb file and add the following code:

require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'mongo'
end

This code adds the Ruby driver as a dependency by using the Bundler dependency management tool.

After you complete these steps, you have a new project directory with the driver dependencies installed.

Note

If you run into issues on this step, ask for help in the MongoDB Community Forums or submit feedback by using the Rate this page tab on the right side of this page.

Back

Get Started