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

Handle collection names which match Windows reserved filenames

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: mongodump
    • 1,250

      It is impossible to dump to directory a collection which matches one of the the reserved windows filenames (e.g. "con" or "aux"): https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions

      On Windows 10, aux, prn, com1, lpt1 all produce the following error:

      Failed: error dumping metadata: error creating metadata file dump\test\lpt1.metadata.json: open dump\test\lpt1.metadata.json: The system cannot find the file specified.

      con produces this different error:

      Failed: error dumping metadata: error creating metadata file dump\test\con.metadata.json: open dump\test\con.metadata.json: The parameter is incorrect.

      nul worked as normal.

      It is possible to dump to an archive instead, so there is a simple workaround.

      However, the error messages for these collections are unclear. As a small enhancement might be to provide a clearer error message. We could also dump any collections with windows reserved names using the same method we use for long collection names (i.e. append a hash to the filename).

            Assignee:
            Unassigned Unassigned
            Reporter:
            tim.fogarty@mongodb.com Tim Fogarty
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: