Skip to content

DOCSP-41954: Create a connection string #99

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ build/*
build
*~
*giza.log
source/*
backups/*
3 changes: 2 additions & 1 deletion source/get-started.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ Get Started with the PHP Library

.. toctree::

/get-started/create-a-deployment/
/get-started/create-a-deployment/
/get-started/create-a-connection-string/
68 changes: 68 additions & 0 deletions source/get-started/create-a-connection-string.txt
Original file line number Diff line number Diff line change
@@ -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 <php-create-deployment>`,
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 ``<username>`` and ``<password>`` 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
2 changes: 1 addition & 1 deletion source/get-started/create-a-deployment.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading