@@ -264,6 +264,15 @@ Behavior
264
264
the :dbtools:`--archive </mongodump/#std-option-mongodump.--archive>`
265
265
option.
266
266
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
+
267
276
Restore to Matching Server Version
268
277
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
269
278
@@ -1098,3 +1107,22 @@ connect to a MongoDB Atlas cluster:
1098
1107
.. code-block:: none
1099
1108
1100
1109
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