|
| 1 | +.. _ruby-get-started-connection-string: |
| 2 | + |
| 3 | +========================== |
| 4 | +Create a Connection String |
| 5 | +========================== |
| 6 | + |
| 7 | +You can connect to your MongoDB deployment by providing a |
| 8 | +**connection URI**, also called a *connection string*, which |
| 9 | +instructs the driver how to connect to a MongoDB deployment |
| 10 | +and how to behave while connected. |
| 11 | + |
| 12 | +The connection string includes the hostname or IP address and |
| 13 | +port of your deployment, the authentication mechanism, user credentials |
| 14 | +when applicable, and connection options. |
| 15 | + |
| 16 | +.. TODO: |
| 17 | + To connect to an instance or deployment not hosted on Atlas, see |
| 18 | + :ref:`ruby-connection-targets`. |
| 19 | + |
| 20 | +.. procedure:: |
| 21 | + :style: connected |
| 22 | + |
| 23 | + .. step:: Find your MongoDB Atlas connection string |
| 24 | + |
| 25 | + To retrieve your connection string for the deployment that |
| 26 | + you created in the :ref:`previous step <ruby-get-started-create-deployment>`, |
| 27 | + log in to your Atlas account and navigate to the |
| 28 | + :guilabel:`Clusters` section. Then, click the :guilabel:`Connect` button |
| 29 | + for your new deployment. |
| 30 | + |
| 31 | + .. figure:: /includes/figures/atlas_connection_connect_cluster.png |
| 32 | + :alt: The connect button in the clusters section of the Atlas UI |
| 33 | + |
| 34 | + Proceed to the :guilabel:`Connect your application` section. Select |
| 35 | + "Ruby" from the :guilabel:`Driver` selection menu and the version |
| 36 | + that best matches your installed version from the :guilabel:`Version` |
| 37 | + selection menu. |
| 38 | + |
| 39 | + .. step:: Copy your connection string |
| 40 | + |
| 41 | + Click the copy button on the right of the connection string to copy it to |
| 42 | + your clipboard, as shown in the following screenshot: |
| 43 | + |
| 44 | + .. figure:: /includes/figures/atlas_connection_copy_string_ruby.png |
| 45 | + :alt: The connection string copy button in the Atlas UI |
| 46 | + |
| 47 | + .. step:: Update the placeholders |
| 48 | + |
| 49 | + Paste this connection string into a file in your preferred text editor |
| 50 | + and replace the ``<db_username>`` and ``<db_password>`` placeholders with |
| 51 | + your database user's username and password. |
| 52 | + |
| 53 | + Save this file to a safe location for use in the next step. |
| 54 | + |
| 55 | +After completing these steps, you have a connection string that |
| 56 | +contains your database username and password. |
| 57 | + |
| 58 | +.. include:: /includes/get-started/quickstart-troubleshoot.rst |
0 commit comments