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

mongorestore will not use the database specified in the URI when restoring from files

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: mongorestore
    • Environment:
      Ubuntu 20.04

      Problem Description

      mongorestore will not use the database specified in the URI when restoring from files. Instead, you will need to manually specify the target database name with "--db" to have the restore working correctly.

      Steps to Reproduce

      Move inside a folder with BSON files to be restored to a database DB_NAME to be created and run the following command (assuming the URI is valid):

      mongorestore --uri "mongodb+srv://${MONGO_USER}:${MONGO_PASS}@${MONGO_HOST}/${DB_NAME}" .

      Expected Results

      Restore operation should perform normally as if the following command was run:

      mongorestore --uri "mongodb+srv://${MONGO_USER}:${MONGO_PASS}@${MONGO_HOST}" --db ${DB_NAME} .

      Actual Results

      Restore operation fails with messages:

      don't know what to do with file "FILE.bson", skipping...

      Additional Notes

            Assignee:
            tim.fogarty@mongodb.com Tim Fogarty
            Reporter:
            edwy.mandret@traydstream.com Edwy Mandret
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: