-
Type: New Feature
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Needed
-
(copied to CRM)
There should be support for specific renaming of namespaces, for restoring from either archives and directory dumps. Currently, renaming isn't really possible with archives. With a directory dump, tinkering with the files can yield renaming, but isn't ideal.
Overview of potential changes:
- five new command line options:
- '--nsExclude <ns-pattern>' excludes matching namespaces. Can be used in
multiplicity. - '--nsInclude <ns-pattern>' includes matching namespaces. Can be used in
multiplicity. Includes are processed before excludes, permitting their
use in combination. - '--nsFrom <ns-pattern>' and '--nsTo <ns-pattern>' correspond to each
other according to the order in which they are specified. Can be used in
multiplicity. - '--dryRun' stops the program before any restoring begins.
- '--nsExclude <ns-pattern>' excludes matching namespaces. Can be used in
- deprecated options:
- --db, --collection, --excludeCollection, --excludeCollectionsWithPrefix
- namespace pattern: <ns-pattern>
- permits includes/excludes/renames to refer to any namespace that
matches a pattern comprised of wild cards, which match their smallest
valid occurrence. - for all includes, all excludes, and simple replacements, asterisks may
be used as wild cards. Replacements correspond linearly to matches.
Literal asterisks and backslashes (*, \) must be backslash-escaped.- examples:
- --nsFrom 'prod.*' --nsTo 'staging.*'
- --nsFrom '*.user*' --nsTo '*.member*'
- --nsExclude 'tests.*' --nsExclude '*.test*'
- --nsInclude 'internal.*' --nsExclude '*.top_secret'
- examples:
- for more complex replacements, dollar sign-delimited wild cards can
assign a matching variable in the form of '$var$'. Replacements do not
need to be linear.- examples:
- --nsFrom '$db$.user$stuff$' --nsTo 'user.$stuff$.$db$'
- --nsFrom 'test_$stack$.$coll$' --nsTo 'recover.$stack$.$coll$'
- examples:
- permits includes/excludes/renames to refer to any namespace that
- is duplicated by
-
TOOLS-1073 mongorestore does not restore data in new database when --archive is used
- Closed
-
TOOLS-31 mongodump: allow -d option to appear multiple times
- Accepted
-
TOOLS-127 Add option to mongorestore to exclude the given database (or databases)
- Closed
-
TOOLS-1120 Add option targetDb to mongorestore when use option --archive
- Closed
-
TOOLS-788 Add argument to mongorestore to exclude given collection(s)
- Closed
- is related to
-
TOOLS-22 Add option to omit databases on mongodump
- Accepted
- related to
-
TOOLS-22 Add option to omit databases on mongodump
- Accepted