Skip to content

DOCSP-45171: Download and Install #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 4 additions & 1 deletion snooty.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name = "ruby-driver"
title = "Ruby MongoDB Driver"
toc_landing_pages = ["/connect"]
toc_landing_pages = [
"/get-started",
"/connect"
]

intersphinx = ["https://www.mongodb.com/docs/manual/objects.inv"]
sharedinclude_root = "https://raw.githubusercontent.com/10gen/docs-shared/main/"
Expand Down
49 changes: 49 additions & 0 deletions source/get-started.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
.. _ruby-get-started:

================================
Get Started with the Ruby Driver
================================

.. contents:: On this page
:local:
:backlinks: none
:depth: 2
:class: singlecol

.. facet::
:name: genre
:values: tutorial

.. meta::
:description: Learn how to create an app to connect to MongoDB deployment by using the Ruby driver.
:keywords: quick start, tutorial, basics

.. toctree::

Download & Install </get-started/download-and-install/>

.. TODO:
Create a Deployment </get-started/create-a-deployment>
Create a Connection String </get-started/create-a-connection-string>
Connect to MongoDB </get-started/connect-to-mongodb>
Next Steps </get-started/next-steps>

Overview
--------

The {+driver-long+} is a library that allows Ruby applications to interact with
MongoDB databases. You can use the {+driver-short+} to connect to MongoDB and perform
common data operations. This guide shows you how to create an application that uses the
{+driver-short+} to connect to a MongoDB cluster hosted on MongoDB Atlas
and query data in your cluster.

.. tip::

MongoDB Atlas is a fully managed cloud database service that hosts your MongoDB
deployments. You can create your own free (no credit card required) MongoDB Atlas
deployment by following the steps in this guide.

Follow this guide to connect a sample Ruby application to a MongoDB Atlas
deployment. If you prefer to connect to MongoDB using a different driver or
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this first sentence needed after the last sentence in the previous (non-tip) paragraph?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems repetitive, I'll remove it

programming language, see our :driver:`list of official drivers <>`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
deployment. If you prefer to connect to MongoDB using a different driver or
programming language, see our :driver:`list of official drivers <>`.
deployment. If you prefer to use a different driver or
programming language to connect to MongoDB, see our :driver:`list of official drivers <>`.


78 changes: 78 additions & 0 deletions source/get-started/download-and-install.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
.. _ruby-quick-start-download-and-install:

====================
Download and Install
====================

.. facet::
:name: genre
:values: tutorial

.. meta::
:keywords: installation, setup, code example

.. procedure::
:style: connected

.. step:: Install dependencies

Before you being developing, ensure you have the following dependencies
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Before you being developing, ensure you have the following dependencies
Before you begin developing, ensure you have the following dependencies

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, thanks for catching

installed in your development environment:

- `Ruby <https://www.ruby-lang.org/en/downloads/>`__ version 2.7
or later
- `bson <https://rubygems.org/gems/bson>`__ versions 4.14.1 to 6.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: do they need all of these bson versions?

you could consider making this a step in the following procedure, since that's also where they install the mongo gem

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I meant the version must be greater than 4.14.1 and less than 6.0


.. note::

{+language+} is pre-installed on macOS and some Linux distributions,
but the system version might be outdated. You can use a package
manager, such as `Homebrew <https://formulae.brew.sh/formula/ruby>`__,
to install the latest {+language+} version.

.. step:: Install the {+driver-short+}

From your shell, run the following command to install
the {+driver-short+}:

.. code-block:: bash

gem install mongo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Installing gems using gem install may fail if a system wide Ruby installation is used. It is also considered as not the best practice in general nowadays.

It might be better to use bundler for managing the getting started project. Any modern distribution of Ruby comes with Bundler preinstalled by default.

If the project is going to be a single file, then inlined bundler is ideal:

require 'bundler/inline'

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just a single file, so I will add inlined bundler instructions


This command installs version {+version-number+} of
the driver.

.. step:: Create a project directory

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

.. code-block:: bash

mkdir ruby-quickstart

Select the tab corresponding to your operating system and run the following commands
to create a ``quickstart.rb`` file in the ``ruby-quickstart`` directory:

.. tabs::

.. tab:: macOS / Linux
:tabid: create-file-mac-linux

.. code-block:: bash

cd ruby-quickstart
touch quickstart.rb

.. tab:: Windows
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not officially support Ruby driver on Windows, so I am not sure if Windows should be mentioned in the getting started.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a note about this

:tabid: create-file-windows

.. code-block:: bash

cd ruby-quickstart
type nul > quickstart.rb

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

.. include:: /includes/get-started/troubleshoot.rst
6 changes: 6 additions & 0 deletions source/includes/get-started/troubleshoot.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.. note::

If you run into issues on this step, ask for help in the
:community-forum:`MongoDB Community Forums <tag/ruby/>`
or submit feedback by using the :guilabel:`Rate this page`
tab on the right or bottom right side of this page.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: do you know why we specify both locations? this was only on the top right on the pages i checked

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it depends on the browser/device? not sure, but I'll reword to just "right side"

15 changes: 7 additions & 8 deletions source/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
.. toctree::
:titlesonly:
:maxdepth: 1


Get Started </get-started>
Connect </connect>
View the Source <https://github.com/mongodb/mongo-ruby-driver>
API Documentation <{+api-root+}>

.. TODO:
Get Started </get-started>
Connect </connect>
Databases & Collections </databases-collections>
Read Data </read>
Write Data </write>
Expand All @@ -37,12 +37,11 @@ Introduction
Welcome to the documentation site for the {+driver-long+}, the official
MongoDB driver for {+language+} applications.

.. TODO:
.. Get Started
.. -----------
Get Started
-----------

.. Learn how to install the driver, establish a connection to MongoDB, and begin
.. working with data in the :ref:`ruby-get-started` tutorial.
Learn how to install the driver, establish a connection to MongoDB, and begin
working with data in the :ref:`ruby-get-started` tutorial.

.. Connect to MongoDB
.. ------------------
Expand Down
Loading