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

Handle collection names which match Windows reserved filenames

    XMLWordPrintable

Details

    • New Feature
    • Status: Accepted
    • Minor - P4
    • Resolution: Unresolved
    • None
    • None
    • mongodump

    Description

      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).

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated: