@@ -958,12 +958,18 @@ Options
958
958
:option:`mongodump --gzip`
959
959
960
960
To restore from a dump directory that contains compressed files, run
961
- ``mongorestore`` with the :option:` --gzip` option.
961
+ ``mongorestore`` with the `` --gzip` ` option.
962
962
963
963
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
965
965
--archive>` options.
966
966
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
+
967
973
.. option:: --archive=<file>
968
974
969
975
Restores from the specified archive file or, if the file is
@@ -1137,11 +1143,12 @@ on port ``27017``.
1137
1143
Change Collection Namespaces during Restore
1138
1144
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1139
1145
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*
1145
1152
support using dollar signs to delimit "wild card" variables to use in
1146
1153
the replacement.
1147
1154
@@ -1223,7 +1230,7 @@ compressed archive files created by :binary:`~bin.mongodump`.
1223
1230
1224
1231
To restore from a dump directory that contains compressed files, run
1225
1232
``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``
1227
1234
database from the compressed files located in the default ``dump``
1228
1235
directory:
1229
1236
@@ -1241,6 +1248,14 @@ database from the archive file ``test.20150715.gz``.
1241
1248
1242
1249
mongorestore --gzip --archive=test.20150715.gz --nsInclude="test.*"
1243
1250
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
+
1244
1259
.. _mongorestore-example-archive-stdin:
1245
1260
1246
1261
Restore a Database from Standard Input
0 commit comments