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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Duplicate
    • None
    • None
    • mongorestore
    • Ubuntu 20.04

    Description

      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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: