|
| 1 | +.. _laravel-quick-start-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 on 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 | +To connect to an instance or deployment not hosted on Atlas, see |
| 17 | +:manual:`Connection Strings </reference/connection-string/>` in the Server |
| 18 | +manual. |
| 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 <laravel-quick-start-create-deployment>`, |
| 27 | + log in to your Atlas account. Then, navigate to the |
| 28 | + :guilabel:`Database` section and click the :guilabel:`Connect` button |
| 29 | + for your new deployment. |
| 30 | + |
| 31 | + .. figure:: /includes/figures/atlas_connection_select_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 | + "PHP" from the :guilabel:`Driver` selection menu and the version |
| 36 | + that best matches the version you installed from the :guilabel:`Version` |
| 37 | + selection menu. |
| 38 | + |
| 39 | + Select the :guilabel:`Password (SCRAM)` authentication mechanism. |
| 40 | + |
| 41 | + Deselect the :guilabel:`Include full driver code example` option to view |
| 42 | + the connection string. |
| 43 | + |
| 44 | + .. step:: Copy your connection string |
| 45 | + |
| 46 | + Click the button on the right of the connection string to copy it |
| 47 | + to your clipboard. |
| 48 | + |
| 49 | + .. step:: Update the placeholders |
| 50 | + |
| 51 | + Paste this connection string into a file in your preferred text editor |
| 52 | + and replace the ``<username>`` and ``<password>`` placeholders with |
| 53 | + your database user's username and password. |
| 54 | + |
| 55 | + Save this file to a safe location for use in the next step. |
| 56 | + |
| 57 | +After completing these steps, you have a connection string that |
| 58 | +contains your database username and password. |
| 59 | + |
| 60 | +.. include:: /includes/quick-start/troubleshoot.rst |
| 61 | + |
| 62 | +.. button:: Next: Configure Your MongoDB Connection |
| 63 | + :uri: /quick-start/configure-mongodb/ |
0 commit comments