Skip to content

Commit ef19954

Browse files
authored
Clarify that --gzip supports using --nsTo and --nsFrom options. (#115)
* Add info about using --nsTo and --nsFrom with --gzip * testing snooty autobuild * rewording
1 parent 863ce5f commit ef19954

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

source/mongorestore.txt

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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``.
11371143
Change 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*
11451152
support using dollar signs to delimit "wild card" variables to use in
11461153
the replacement.
11471154

@@ -1223,7 +1230,7 @@ compressed archive files created by :binary:`~bin.mongodump`.
12231230

12241231
To 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``
12271234
database from the compressed files located in the default ``dump``
12281235
directory:
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

12461261
Restore a Database from Standard Input

0 commit comments

Comments
 (0)