@@ -264,6 +264,15 @@ Behavior
264264 the :dbtools:`--archive </mongodump/#std-option-mongodump.--archive>`
265265 option.
266266
267+ Using ``mongodump`` Without an ``authSource``
268+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
269+
270+ When :urioption:`authSource` is not specified in the MongoDB URI, the
271+ database name specified in :option:`--db` is used both to authenticate
272+ your ``mongodump`` session and to indicate the database being dumped. For
273+ an example of using a different database for authentication when using
274+ ``mongodump``, see :ref:`mongodump-auth-dump`.
275+
267276Restore to Matching Server Version
268277~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
269278
@@ -1098,3 +1107,22 @@ connect to a MongoDB Atlas cluster:
10981107.. code-block:: none
10991108
11001109 mongodump 'mongodb+srv://cluster0.example.com/testdb?authSource=$external&authMechanism=MONGODB-AWS' <other options>
1110+
1111+ .. _mongodump-auth-dump:
1112+
1113+ Authenticating with a Specific Database
1114+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1115+
1116+ To authenticate with a different database than the one being dumped, you
1117+ must specify ``authSource`` in the MongoDB URI.
1118+
1119+ In this example:
1120+
1121+ - The username ``myuser`` and password ``mypassword`` is used. This user
1122+ has read access to ``testdb``.
1123+ - The ``admin`` database is used to authenticate the user.
1124+ - The ``testdb`` database is being dumped.
1125+
1126+ .. code-block:: none
1127+
1128+ mongodump 'mongodb+srv://myuser:
[email protected] /?authSource=admin' --db testdb
0 commit comments