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

mongorestore from stdin demands collection option

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.4.9, 3.6.1
    • Component/s: mongorestore

      TOOLS-1234 created options to rename namespaces during restore but it doesn't seem to play well with restoring from stdin:

      mongodump -d agg -c rollup -q '{item:"Chair"}' -o - | mongorestore --nsFrom 'agg.rollup' --nsTo 'test.rollup' --dir -
      2017-12-28T10:29:33.830-0500	writing agg.rollup to stdout
      2017-12-28T10:29:33.831-0500	Failed: cannot restore from stdin without a specified collection
      2017-12-28T10:29:33.840-0500	Failed: error writing data for collection `agg.rollup` to disk: write /dev/stdout: broken pipe
      

      But using -d and -c yields a warning about deprecation:

      mongodump -d agg -c rollup -q '{item:"Chair"}' -o - | mongorestore -d test -c rollup --dir -
      2017-12-28T10:26:57.282-0500	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
      

      Plus how is using --nsInclude going to help when I want to rename?

            Assignee:
            Unassigned Unassigned
            Reporter:
            asya.kamsky@mongodb.com Asya Kamsky
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: