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

XMLWordPrintableJSON

      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 (Inactive)
            Reporter:
            Edwy Mandret
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: