Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-1234

mongorestore namespace renaming support

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.3.11
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Needed

      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.
      • 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'
        • 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$'

            Assignee:
            lucas.morales Lucas Morales
            Reporter:
            lucas.morales Lucas Morales
            Votes:
            3 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: