-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: None
-
Labels:None
The docs for 3.4 about --nsInclude were confusing to me.
Specifically, the phrases specify multiple collections and matches the smallest valid occurence seem to contradict each other.
I'm coming from 3.2, for that version I created a script that downloads a backup, unzips it and restores the database to the local mongodb:
(cd dump && tar xf $DBNAME.tgz)
mongo --eval "db.dropDatabase()" $DBNAME
mongorestore -d $DBNAME dump/$DBNAME
That command issues a warning in 3.4:
the --db and --collection args should only be used when restoring from a BSON file. Other uses are deprecated and will not exist in the future; use --nsInclude instead
For me it's unclear how to map -d to --nsInclude.
The full docs (https://docs.mongodb.com/manual/reference/program/mongorestore/#cmdoption-nsinclude):
--nsInclude <namespace pattern>
New in version 3.4.Includes only the specified namespaces in the restore operation. By enabling you to specify multiple collections to restore, --nsInclude offers a superset of the functionality of the --collection option.
--nsInclude accepts a namespace pattern as its argument. The namespace pattern permits --nsInclude to refer to any namespace that matches the specified pattern. mongorestore matches the smallest valid occurence of the namespace pattern.
Use asterisks as wild cards. Escape all literal asterisks and backslashes with a backslash. Restore Collections Using Wild Cards provides an example of using asterisks as wild cards.
- is related to
-
DOCS-12579 mongorestore docs show deprecated example with --archive and --db
- Closed