Uploaded image for project: 'MongoDB ETL Tools'
  1. MongoDB ETL Tools
  2. TOOLS-2161

Syntax for mongodump pipe mongorestore should be consistent in windows-linux-osx or otherwise documented

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Accepted
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: mongodump, mongorestore
    • Labels:
      None

      Description

      The syntax mentioned here works in OSX (did not test in Linux), however in a windows environment using powershell we need to add = to --archive option to work. This is not documented and caused a user frustration.
      This is how it works in Windows:

      PS C:\Program Files\MongoDB\Server\4.0\bin> ./mongodump --archive= | ./mongorestore --archive= --port 27018 --drop
      2018-12-03T03:09:23.483+0000    writing admin.system.version to
      2018-12-03T03:09:23.523+0000    done dumping admin.system.version (1 document)
      2018-12-03T03:09:23.523+0000    writing testLuke.testCollLuke to
      2018-12-03T03:09:23.526+0000    done dumping testLuke.testCollLuke (1 document)
      2018-12-03T03:09:24.666+0000    using default 'dump' directory
      2018-12-03T03:09:24.709+0000    preparing collections to restore from
      2018-12-03T03:09:24.719+0000    reading metadata for testLuke.testCollLuke from dump\testLuke\testCollLuke.metadata.json
      2018-12-03T03:09:24.750+0000    restoring testLuke.testCollLuke from dump\testLuke\testCollLuke.bson
      2018-12-03T03:09:24.760+0000    no indexes to restore
      2018-12-03T03:09:24.763+0000    finished restoring testLuke.testCollLuke (1 document)
      2018-12-03T03:09:24.764+0000    done
      PS C:\Program Files\MongoDB\Server\4.0\bin>
      

      If I run it without = as explained in the documentation it produce an error:

      PS C:\Program Files\MongoDB\Server\4.0\bin>
      PS C:\Program Files\MongoDB\Server\4.0\bin> ./mongodump --archive | ./mongorestore --archive --port 27018 --drop
      2018-12-03T03:16:18.697+0000    writing admin.system.version to archive on stdout
      2018-12-03T03:16:18.739+0000    done dumping admin.system.version (1 document)
      2018-12-03T03:16:18.739+0000    writing testLuke.testCollLuke to archive on stdout
      2018-12-03T03:16:18.743+0000    done dumping testLuke.testCollLuke (1 document)
      2018-12-03T03:16:19.880+0000    Failed: stream or file does not appear to be a mongodump archive
      PS C:\Program Files\MongoDB\Server\4.0\bin>
      

      Note that this is working in OSX.

      I propose to standardize the syntax between platform.

        Attachments

          Activity

            People

            • Assignee:
              backlog-server-tools Backlog - Server Tools Team
              Reporter:
              ivan.grigolon Ivan Grigolon
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: