Skip to content

Commit aab488d

Browse files
authored
DOCSP-41954: Create a connection string (#99)
* DOCSP-41954: Create a connection string * edits * spacing
1 parent 42838af commit aab488d

File tree

6 files changed

+71
-3
lines changed

6 files changed

+71
-3
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ build/*
33
build
44
*~
55
*giza.log
6-
source/*
76
backups/*

source/get-started.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ Get Started with the PHP Library
2020

2121
.. toctree::
2222

23-
/get-started/create-a-deployment/
23+
/get-started/create-a-deployment/
24+
/get-started/create-a-connection-string/
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
.. _php-connection-string:
2+
3+
==========================
4+
Create a Connection String
5+
==========================
6+
7+
.. facet::
8+
:name: genre
9+
:values: tutorial
10+
11+
.. meta::
12+
:keywords: uri, atlas
13+
14+
You can connect to your MongoDB deployment by providing a
15+
**connection URI**, also called a *connection string*, which
16+
instructs the driver on how to connect to a MongoDB deployment
17+
and how to behave while connected.
18+
19+
The connection string includes the hostname or IP address and
20+
port of your deployment, the authentication mechanism, user credentials
21+
when applicable, and connection options.
22+
23+
.. TODO:
24+
To connect to an instance or deployment not hosted on Atlas, see
25+
:ref:`php-connection-targets`.
26+
27+
.. procedure::
28+
:style: connected
29+
30+
.. step:: Find your MongoDB Atlas Connection String
31+
32+
To retrieve your connection string for the deployment that
33+
you created in the :ref:`previous step <php-create-deployment>`,
34+
log in to your Atlas account and navigate to the
35+
:guilabel:`Database` section and click the :guilabel:`Connect` button
36+
for your new deployment.
37+
38+
.. figure:: /includes/figures/atlas_connection_select_cluster.png
39+
:alt: The connect button in the clusters section of the Atlas UI
40+
41+
Then, select your user from the :guilabel:`Select database user`
42+
selection menu. Select "PHP" from the :guilabel:`Driver` selection
43+
menu and the version that best matches the version you installed
44+
from the :guilabel:`Version` selection menu.
45+
46+
Select the :guilabel:`String` tab in the :guilabel:`Add connection string into your application code`
47+
step to view only the connection string.
48+
49+
.. step:: Copy your Connection String
50+
51+
Click the button on the right of the connection string to copy it
52+
to your clipboard, as shown in the following screenshot:
53+
54+
.. figure:: /includes/figures/atlas_connection_copy_string_php.png
55+
:alt: The copy button next to the connection string in the Atlas UI
56+
57+
.. step:: Update the Placeholders
58+
59+
Paste this connection string into a file in your preferred text editor
60+
and replace the ``<username>`` and ``<password>`` placeholders with
61+
your database user's username and password.
62+
63+
Save this file to a safe location for use in the next step.
64+
65+
After completing these steps, you have a connection string that
66+
corresponds to your Atlas cluster.
67+
68+
.. include:: /includes/get-started/troubleshoot.rst

source/get-started/create-a-deployment.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Create a MongoDB Deployment
99
:values: tutorial
1010

1111
.. meta::
12-
:keywords: cloud, uri, atlas
12+
:keywords: cloud, host, atlas
1313

1414
You can create a free tier MongoDB deployment on MongoDB Atlas
1515
to store and manage your data. MongoDB Atlas hosts and manages
Loading
Loading

0 commit comments

Comments
 (0)