Skip to content

Commit 58b96d9

Browse files
DOCSP-16967-inconsistent-connection-string-attribute-description (#385)
* DOCSP-16967-inconsistent-connection-string-attribute-description * monospace typo * typo * clarifications * fix default database used * reviewer updates
1 parent 3c87c24 commit 58b96d9

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

source/connect.txt

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,17 +345,32 @@ To connect to a deployment using TLS, you can either:
345345
Connect to a Specific Database
346346
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
347347

348-
To connect to a specific database, specify a database in your
349-
:manual:`connection string URI path </reference/connection-string/>`. If
350-
you do not specify a database in your URI path, you connect to the
351-
``test`` database.
348+
To connect to a specific default database, specify a database in your
349+
:manual:`connection string URI path </reference/connection-string/>`.
350+
If unspecified by the connection string, the default database
351+
is the ``test`` database.
352352

353353
For example, to connect to a database called ``qa`` on localhost, run the
354354
following command:
355355

356356
.. code-block:: sh
357357

358-
mongosh "mongodb://localhost:27017/qa"
358+
mongosh "mongodb://localhost:27017/qa"
359+
360+
You can specify the authentication database in your connection string
361+
using the :urioption:`authSource` connection option. If specified, the
362+
client uses this database to verify your user identity and credentials.
363+
If :urioption:`authSource` is unspecified, it defaults to the default
364+
database specified in the connection string. If both :urioption:`authSource`
365+
and the default database are unspecified,
366+
:urioption:`authSource` defaults to the ``admin`` database.
367+
368+
The following connection string sets the default database to ``myDefaultDB``
369+
and the authentication database to ``admin``:
370+
371+
.. code-block:: bash
372+
373+
mongodb://myDatabaseUser:D1fficultP%[email protected]:27017/myDefaultDB?authSource=admin
359374

360375
Proxy Settings
361376
~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)