@@ -67,17 +67,11 @@ Version Compatibility
67
67
68
68
.. include:: /includes/warning-mongodump-compatibility-2.2.rst
69
69
70
- .. COMMENT upon completion of TOOLS-1035, either delete the whole section or delete everything after the semicolon.
71
-
72
70
Exclude ``system.profile`` Collection
73
71
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
74
72
75
73
:binary:`~bin.mongorestore` does not restore the :data:`system.profile
76
- <<database>.system.profile>` collection data; however, if the backup
77
- data includes :data:`system.profile <<database>.system.profile>`
78
- collection data and the collection does not exist in the target
79
- database, :binary:`~bin.mongorestore` creates the collection but does not
80
- insert any data into the collection.
74
+ <<database>.system.profile>` collection data.
81
75
82
76
.. _mongorestore-required-access:
83
77
@@ -213,13 +207,14 @@ running on the localhost interface on port ``27017``.
213
207
214
208
.. versionadded:: 3.4
215
209
216
- You may alternatively use :option:`--nsInclude <mongorestore --nsInclude>` to specify the
217
- canonical name of the collection that you wish to restore rather than
218
- :option:`--collection <mongorestore --collection>`. :option:`--nsInclude <mongorestore --nsInclude>` enables you to specify
219
- the :term:`namespace` of one or more collections that you
220
- wish to include in the restore operation. The following example
221
- restores the ``people`` collection from the ``accounts`` database
222
- in the ``dump/`` sub-directory of the current directory:
210
+ You may alternatively use :option:`--nsInclude <mongorestore
211
+ --nsInclude>` to specify the canonical name of the collection that you
212
+ wish to restore rather than :option:`--collection <mongorestore
213
+ --collection>`. :option:`--nsInclude <mongorestore --nsInclude>`
214
+ enables you to specify the :term:`namespace` of one or more collections
215
+ that you wish to include in the restore operation. The following
216
+ example restores the ``people`` collection from the ``accounts``
217
+ database in the ``dump/`` sub-directory of the current directory:
223
218
224
219
.. code-block:: sh
225
220
@@ -232,18 +227,20 @@ Restore Collections Using Wild Cards
232
227
233
228
.. versionadded:: 3.4
234
229
235
- :option:`--nsInclude <mongorestore --nsInclude>` and :option:`--nsExclude <mongorestore --nsExclude>` support specifying
236
- the :term:`namespaces <namespace>` you wish to include or exclude from a restore operation
237
- using asterisks as *wild cards*.
230
+ :option:`--nsInclude <mongorestore --nsInclude>` and
231
+ :option:`--nsExclude <mongorestore --nsExclude>` support specifying the
232
+ :term:`namespaces <namespace>` you wish to include or exclude from a
233
+ restore operation using asterisks as *wild cards*.
238
234
239
235
The following example restores the documents in the ``dump/``
240
236
sub-directory of the current directory that match the specified
241
- namespace pattern. The :option:`--nsInclude <mongorestore --nsInclude>` statement specifies to
242
- only restore documents in the ``transactions`` database while
243
- :option:`--nsExclude <mongorestore --nsExclude>` instructs :binary:`~bin.mongorestore` to exclude
244
- collections whose names end with ``_dev``. :binary:`~bin.mongorestore`
245
- restores data to the :binary:`~bin.mongod` instance running on the
246
- localhost interface on port ``27017``.
237
+ namespace pattern. The :option:`--nsInclude <mongorestore --nsInclude>`
238
+ statement specifies to only restore documents in the ``transactions``
239
+ database while :option:`--nsExclude <mongorestore --nsExclude>`
240
+ instructs :binary:`~bin.mongorestore` to exclude collections whose
241
+ names end with ``_dev``. :binary:`~bin.mongorestore` restores data to
242
+ the :binary:`~bin.mongod` instance running on the localhost interface
243
+ on port ``27017``.
247
244
248
245
.. code-block:: sh
249
246
@@ -256,15 +253,17 @@ Change Collections' Namespaces during Restore
256
253
257
254
.. versionadded:: 3.4
258
255
259
- MongoDB 3.4 added the :option:`--nsFrom <mongorestore --nsFrom>` and :option:`--nsTo <mongorestore --nsTo>` options,
260
- which enable you to change the namespace of a collection that you are
261
- restoring. :option:`--nsFrom <mongorestore --nsFrom>` and :option:`--nsTo <mongorestore --nsTo>` support using
262
- asterisks as wild cards *and* support using dollar signs to delimit
263
- "wild card" variables to use in the replacement.
256
+ MongoDB 3.4 added the :option:`--nsFrom <mongorestore --nsFrom>` and
257
+ :option:`--nsTo <mongorestore --nsTo>` options, which enable you to
258
+ change the namespace of a collection that you are restoring.
259
+ :option:`--nsFrom <mongorestore --nsFrom>` and :option:`--nsTo
260
+ <mongorestore --nsTo>` support using asterisks as wild cards *and*
261
+ support using dollar signs to delimit "wild card" variables to use in
262
+ the replacement.
264
263
265
264
Consider a database ``data`` that you have exported to a ``dump/``
266
- directory using :binary:`~bin.mongodump`. The ``data`` database contains the following
267
- collections:
265
+ directory using :binary:`~bin.mongodump`. The ``data`` database
266
+ contains the following collections:
268
267
269
268
- ``sales_customer1``
270
269
- ``sales_customer2``
@@ -273,11 +272,13 @@ collections:
273
272
- ``users_customer2``
274
273
- ``users_customer3``
275
274
276
- Using :option:`--nsFrom <mongorestore --nsFrom>` and :option:`--nsTo <mongorestore --nsTo>`, you can restore the data
277
- into different namespaces. The following operation
275
+ Using :option:`--nsFrom <mongorestore --nsFrom>` and :option:`--nsTo
276
+ <mongorestore --nsTo>`, you can restore the data into different
277
+ namespaces. The following operation
278
278
279
- - restores the ``sales_<customerName>`` collections in the ``data`` database to
280
- ``sales`` collections in the ``<customerName>`` database, and
279
+ - restores the ``sales_<customerName>`` collections in the ``data``
280
+ database to ``sales`` collections in the ``<customerName>`` database,
281
+ and
281
282
282
283
- restores the ``users_<customerName>`` collections to ``users``
283
284
collections in the ``<customerName>`` database.
@@ -289,12 +290,12 @@ into different namespaces. The following operation
289
290
Restore with Access Control
290
291
~~~~~~~~~~~~~~~~~~~~~~~~~~~
291
292
292
- In the following example, :binary:`~bin.mongorestore` restores a database
293
- dump located at ``/opt/backup/mongodump-2011-10-24``, to a database
294
- running on port ``37017`` on the host
295
- ``mongodb1.example.net``. The :binary:`~bin.mongorestore` command authenticates to
296
- the MongoDB instance using the username ``user`` and the
297
- password ``pass``, as follows:
293
+ In the following example, :binary:`~bin.mongorestore` restores a
294
+ database dump located at ``/opt/backup/mongodump-2011-10-24``, to a
295
+ database running on port ``37017`` on the host
296
+ ``mongodb1.example.net``. The :binary:`~bin.mongorestore` command
297
+ authenticates to the MongoDB instance using the username ``user`` and
298
+ the password ``pass``, as follows:
298
299
299
300
.. code-block:: sh
300
301
@@ -333,8 +334,8 @@ Restore a Database from Standard Input
333
334
334
335
.. versionadded:: 3.2
335
336
336
- To restore from the standard input, run :binary:`~bin.mongorestore` with the
337
- ``archive`` option but *omit* the filename. For example:
337
+ To restore from the standard input, run :binary:`~bin.mongorestore`
338
+ with the ``archive`` option but *omit* the filename. For example:
338
339
339
340
.. code-block:: sh
340
341
@@ -350,9 +351,9 @@ Restore from Compressed Data
350
351
compressed files or data stream created by :binary:`~bin.mongodump`.
351
352
352
353
To restore from a dump directory that contains compressed files, run
353
- :binary:`~bin.mongorestore` with the new ``--gzip`` option. For example, the
354
- following operation restores the ``test`` database from the compressed
355
- files located in the default ``dump`` directory:
354
+ :binary:`~bin.mongorestore` with the new ``--gzip`` option. For
355
+ example, the following operation restores the ``test`` database from
356
+ the compressed files located in the default ``dump`` directory:
356
357
357
358
.. code-block:: sh
358
359
0 commit comments