@@ -958,12 +958,18 @@ Options
958958 :option:`mongodump --gzip`
959959
960960 To restore from a dump directory that contains compressed files, run
961- ``mongorestore`` with the :option:` --gzip` option.
961+ ``mongorestore`` with the `` --gzip` ` option.
962962
963963 To restore from a compressed archive file, run ``mongorestore`` with
964- both the :option:` --gzip` and the :option:`--archive <mongorestore
964+ both the `` --gzip` ` and the :option:`--archive <mongorestore
965965 --archive>` options.
966966
967+ .. note::
968+
969+ You can use the :option:`--nsFrom <mongorestore --nsFrom>` and
970+ :option:`--nsTo <mongorestore --nsTo>` options with the ``--gzip`` option to
971+ change the namespace of the collection that you are restoring.
972+
967973.. option:: --archive=<file>
968974
969975 Restores from the specified archive file or, if the file is
@@ -1137,11 +1143,12 @@ on port ``27017``.
11371143Change Collection Namespaces during Restore
11381144~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11391145
1140- You can use the :option:`--nsFrom <mongorestore --nsFrom>` and
1141- :option:`--nsTo <mongorestore --nsTo>` options to change the namespace
1142- of the collection that you are restoring.
1143- :option:`--nsFrom <mongorestore --nsFrom>` and :option:`--nsTo
1144- <mongorestore --nsTo>` support using asterisks as wild cards *and*
1146+ To change the namespace of the collection that you are restoring, use the
1147+ :option:`--nsFrom <mongorestore --nsFrom>` and :option:`--nsTo <mongorestore --nsTo>`
1148+ options.
1149+
1150+ The :option:`--nsFrom <mongorestore --nsFrom>` and :option:`--nsTo
1151+ <mongorestore --nsTo>` options support using asterisks as wild cards *and*
11451152support using dollar signs to delimit "wild card" variables to use in
11461153the replacement.
11471154
@@ -1223,7 +1230,7 @@ compressed archive files created by :binary:`~bin.mongodump`.
12231230
12241231To restore from a dump directory that contains compressed files, run
12251232``mongorestore`` with the :option:`--gzip <mongorestore
1226- --gzip>`. For example, the following operation restores the ``test``
1233+ --gzip>` option . For example, the following operation restores the ``test``
12271234database from the compressed files located in the default ``dump``
12281235directory:
12291236
@@ -1241,6 +1248,14 @@ database from the archive file ``test.20150715.gz``.
12411248
12421249 mongorestore --gzip --archive=test.20150715.gz --nsInclude="test.*"
12431250
1251+ To change the namespace of the collection that you are restoring, use the
1252+ :option:`--nsFrom <mongorestore --nsFrom>` and :option:`--nsTo <mongorestore --nsTo>`
1253+ options with the ``--gzip`` option.
1254+
1255+ .. code-block:: sh
1256+
1257+ mongorestore --gzip --nsFrom='data.$prefix$_$customer$' --nsTo='$customer$.$prefix$'
1258+
12441259.. _mongorestore-example-archive-stdin:
12451260
12461261Restore a Database from Standard Input
0 commit comments