diff --git a/.gitignore b/.gitignore index b42a4f24..85d69aa9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,4 @@ build/* build *~ *giza.log -source/* backups/* diff --git a/source/get-started.txt b/source/get-started.txt index edd20aef..6641f3c3 100644 --- a/source/get-started.txt +++ b/source/get-started.txt @@ -20,4 +20,5 @@ Get Started with the PHP Library .. toctree:: - /get-started/create-a-deployment/ \ No newline at end of file + /get-started/create-a-deployment/ + /get-started/create-a-connection-string/ \ No newline at end of file diff --git a/source/get-started/create-a-connection-string.txt b/source/get-started/create-a-connection-string.txt new file mode 100644 index 00000000..52a096c4 --- /dev/null +++ b/source/get-started/create-a-connection-string.txt @@ -0,0 +1,68 @@ +.. _php-connection-string: + +========================== +Create a Connection String +========================== + +.. facet:: + :name: genre + :values: tutorial + +.. meta:: + :keywords: uri, atlas + +You can connect to your MongoDB deployment by providing a +**connection URI**, also called a *connection string*, which +instructs the driver on how to connect to a MongoDB deployment +and how to behave while connected. + +The connection string includes the hostname or IP address and +port of your deployment, the authentication mechanism, user credentials +when applicable, and connection options. + +.. TODO: + To connect to an instance or deployment not hosted on Atlas, see + :ref:`php-connection-targets`. + +.. procedure:: + :style: connected + + .. step:: Find your MongoDB Atlas Connection String + + To retrieve your connection string for the deployment that + you created in the :ref:`previous step `, + log in to your Atlas account and navigate to the + :guilabel:`Database` section and click the :guilabel:`Connect` button + for your new deployment. + + .. figure:: /includes/figures/atlas_connection_select_cluster.png + :alt: The connect button in the clusters section of the Atlas UI + + Then, select your user from the :guilabel:`Select database user` + selection menu. Select "PHP" from the :guilabel:`Driver` selection + menu and the version that best matches the version you installed + from the :guilabel:`Version` selection menu. + + Select the :guilabel:`String` tab in the :guilabel:`Add connection string into your application code` + step to view only the connection string. + + .. step:: Copy your Connection String + + Click the button on the right of the connection string to copy it + to your clipboard, as shown in the following screenshot: + + .. figure:: /includes/figures/atlas_connection_copy_string_php.png + :alt: The copy button next to the connection string in the Atlas UI + + .. step:: Update the Placeholders + + Paste this connection string into a file in your preferred text editor + and replace the ```` and ```` placeholders with + your database user's username and password. + + Save this file to a safe location for use in the next step. + +After completing these steps, you have a connection string that +corresponds to your Atlas cluster. + +.. include:: /includes/get-started/troubleshoot.rst \ No newline at end of file diff --git a/source/get-started/create-a-deployment.txt b/source/get-started/create-a-deployment.txt index 52c1203a..fa72db96 100644 --- a/source/get-started/create-a-deployment.txt +++ b/source/get-started/create-a-deployment.txt @@ -9,7 +9,7 @@ Create a MongoDB Deployment :values: tutorial .. meta:: - :keywords: cloud, uri, atlas + :keywords: cloud, host, atlas You can create a free tier MongoDB deployment on MongoDB Atlas to store and manage your data. MongoDB Atlas hosts and manages diff --git a/source/includes/figures/atlas_connection_copy_string_php.png b/source/includes/figures/atlas_connection_copy_string_php.png new file mode 100644 index 00000000..b15ef37a Binary files /dev/null and b/source/includes/figures/atlas_connection_copy_string_php.png differ diff --git a/source/includes/figures/atlas_connection_select_cluster.png b/source/includes/figures/atlas_connection_select_cluster.png new file mode 100644 index 00000000..52d827d6 Binary files /dev/null and b/source/includes/figures/atlas_connection_select_cluster.png differ