mongoexport for windows fails when long filenames are included in the executable

XMLWordPrintableJSON

    • Type: Investigation
    • Resolution: Gone away
    • Priority: Minor - P4
    • None
    • Affects Version/s: 100.5.0
    • Component/s: None
    • None
    • Environment:
      mongo DB : MongoDB 4.2.8 Community
      mongo DB Tools version 100.5.1 (Windows x86_64)
      OS: Windows 10 Pro 21H1 19043.1288

      Problem Statement/Rationale

      When the mongoexport command line tool is invoked with the full path name (forgot to add the directory to the PATH variable) command line parsing is messed up.

      When the tool is called with the filename only (without the path) it works normally,

      Steps to Reproduce

      This does not work (path is included in the executable invocation)

      C:\Program Files\MongoDB\Tools\100\bin>C:\"Program Files"\MongoDB\Tools\100\bin\mongoexport --uri="mongodb://localhost:27017/meteor" --collection=roleAssignmentCopy --out=c:\roles.json
      2021-10-15T09:26:18.495+0300 error parsing command line options: error parsing positional arguments: provide only one MongoDB connection string. Connection strings must begin with mongodb:// or mongodb+srv:// schemes
      2021-10-15T09:26:18.496+0300 try 'mongoexport --help' for more information

      This works (same command without long filename)

      C:\Program Files\MongoDB\Tools\100\bin>mongoexport --uri="mongodb://localhost:27017/meteor" --collection=roleAssignmentCopy --out=c:\temp\roles.json
      2021-10-15T09:29:57.311+0300 connected to: mongodb://localhost:27017/meteor
      2021-10-15T09:29:57.374+0300 exported 234 records

       

      Expected Results

      export should work

      Actual Results

      command line parser cannot read the arguments

      Additional Notes

      works with a small workaround

            Assignee:
            Tim Fogarty
            Reporter:
            Efstathios Dimopoulos
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: