|
1 | 1 | Set up a Free Tier Cluster in Atlas
|
2 | 2 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
3 | 3 |
|
4 |
| -After setting up your Go project dependencies, create a MongoDB cluster |
5 |
| -where you can store and manage your data. Complete the |
6 |
| -:atlas:`Get Started with Atlas </getting-started>` guide to set up a new |
7 |
| -Atlas account, free tier MongoDB cluster, load datasets, and |
8 |
| -interact with the data. |
| 4 | +You can create a free tier MongoDB deployment on MongoDB Atlas to store and |
| 5 | +manage your data. MongoDB Altas hosts and manages your MongoDB database in the |
| 6 | +cloud. |
9 | 7 |
|
10 |
| -After completing the steps in the Atlas guide, you should have a new MongoDB |
11 |
| -cluster deployed in Atlas, a new database user, and |
12 |
| -:atlas:`sample datasets loaded </sample-data/>` into your cluster. |
| 8 | +.. procedure:: |
| 9 | + :style: connected |
| 10 | + |
| 11 | + .. step:: Create a free tier cluster |
| 12 | + |
| 13 | + Complete the :atlas:`Get Started with Atlas </getting-started>` guide to |
| 14 | + set up a new Atlas account, create a free tier MongoDB cluster, load |
| 15 | + datasets, and interact with the data. |
| 16 | + |
| 17 | + .. step:: Save your credentials |
| 18 | + |
| 19 | + After you create your database user, save that user's username and |
| 20 | + password to a safe location for use in an upcoming step. |
| 21 | + |
| 22 | +After completing these steps, you have a new MongoDB cluster deployed in |
| 23 | +Atlas, a new database user, and :atlas:`sample datasets loaded </sample-data/>` |
| 24 | +into your cluster. |
13 | 25 |
|
14 | 26 | .. _golang-connect-to-your-cluster:
|
15 | 27 |
|
16 |
| -Connect to your Cluster |
17 |
| ------------------------ |
| 28 | +Connect to Your Cluster |
| 29 | +~~~~~~~~~~~~~~~~~~~~~~~ |
| 30 | + |
| 31 | +You can connect to your MongoDB deployment by providing a |
| 32 | +**connection URI**, also called a *connection string*, which |
| 33 | +instructs the driver on how to connect to a MongoDB deployment |
| 34 | +and how to behave while connected. |
| 35 | + |
| 36 | +The connection string includes the hostname or IP address and |
| 37 | +port of your deployment, the authentication mechanism, user credentials |
| 38 | +when applicable, and connection options. |
| 39 | + |
| 40 | +.. procedure:: |
| 41 | + :style: connected |
| 42 | + |
| 43 | + .. step:: Retrieve your MongoDB Atlas connection string |
| 44 | + |
| 45 | + To retrieve your connection string for the cluster you created in the |
| 46 | + previous section, log in to your Atlas account. Navigate to the |
| 47 | + :guilabel:`Database` section and click :guilabel:`Clusters`. Click the |
| 48 | + :guilabel:`Connect` button for the cluster that you want to connect to as |
| 49 | + shown below: |
| 50 | + |
| 51 | + .. figure:: /includes/figures/atlas_connection_select_cluster.png |
| 52 | + :alt: Atlas Connection GUI cluster selection screen |
18 | 53 |
|
19 |
| -In this step, you create and run an application that uses the Go |
20 |
| -driver to connect to your MongoDB cluster and run a query on the sample |
21 |
| -data. |
| 54 | + Then, select the :guilabel:`Drivers` option under the :guilabel:`Connect |
| 55 | + to your application` header. Select "Go" from the :guilabel:`Driver` |
| 56 | + selection menu and the version that best matches the version you installed |
| 57 | + from the :guilabel:`Version` selection menu. |
22 | 58 |
|
23 |
| -You pass instructions to the driver on where and how to connect to your |
24 |
| -MongoDB cluster in a string called the *connection string*. This string |
25 |
| -includes information on the hostname or IP address and port of your |
26 |
| -cluster, authentication mechanism, user credentials when applicable, and |
27 |
| -other connection options. |
| 59 | + .. step:: Copy your connection string |
28 | 60 |
|
29 |
| -To retrieve your connection string for the cluster and user you created in |
30 |
| -the previous step, log into your Atlas account and navigate to the |
31 |
| -:guilabel:`Database` section and click the :guilabel:`Connect` button for the cluster that you |
32 |
| -want to connect to as shown below. |
| 61 | + Click the button to the right of the connection string to copy it to your |
| 62 | + clipboard, as shown in the following screenshot: |
33 | 63 |
|
34 |
| -.. figure:: /includes/figures/atlas_connection_select_cluster.png |
35 |
| - :alt: Atlas Connection GUI cluster selection screen |
| 64 | + .. figure:: /includes/figures/atlas_connection_copy_string_go.png |
| 65 | + :alt: Atlas Connection GUI connection string screen |
36 | 66 |
|
37 |
| -Proceed to the :guilabel:`Connect Your Application` step and select the Go |
38 |
| -driver. Then, click the :guilabel:`Copy` button to copy the *connection string* |
39 |
| -to your clipboard as shown below. |
| 67 | + .. step:: Update the placeholders |
40 | 68 |
|
41 |
| -.. figure:: /includes/figures/atlas_connection_copy_string_go.png |
42 |
| - :alt: Atlas Connection GUI connection string screen |
| 69 | + Paste this connection string into a file in your preferred text editor |
| 70 | + and replace the ``<db_username>`` and ``<db_password>`` placeholders with |
| 71 | + your database user's username and password. |
| 72 | + |
| 73 | + Save this file to a safe location for use in the next step. |
43 | 74 |
|
44 |
| -Save your Atlas connection string in a safe location that you can access |
45 |
| -for the next step. |
| 75 | +After completing these steps, you have a connection string that corresponds your |
| 76 | +Atlas cluster. |
46 | 77 |
|
47 |
| -To learn more about connecting to the Go driver through Atlas, see |
| 78 | +To learn more about connecting to the {+driver-long+} through Atlas, see |
48 | 79 | the :atlas:`Atlas driver connection guide </driver-connection>`
|
49 |
| -and select **Go** from the *Select your language* dropdown. |
| 80 | +and select **Go** from the :guilabel:`Select your language` dropdown. |
0 commit comments