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

mongorestore --uri still asks for a database

    XMLWordPrintable

Details

    • Bug
    • Status: Accepted
    • Major - P3
    • Resolution: Unresolved
    • 4.0.4
    • None
    • mongorestore
    • None
    • Ubuntu 16

    Description

      I'm trying to dump a collection from a database and restore it to another, using mongodump and mongorestore with the --uri CLI option, and -c for the collection name. Mongodump works as expected, but mongorestore fails with "cannot restore a collection without a specified database".

       

      mongodump --uri=mongodb://user1:pass1@host1:port1/dbname -c mycoll

      mongorestore --uri=mongodb://u2:p2@host2:port2/dbname -c mycoll dump/dbname/mycoll.bson

       

      I would expect mongorestore to accept the same options as mongodump, but I have to specify the database name again using -d:

      mongorestore --uri=mongodb://u2:p2@host2:port2/dbname -d dbname -c mycoll dump/dbname/mycoll.bson

      This seems redundant, since the database name is already specficied in the uri option.

      Attachments

        Activity

          People

            backlog-server-tools Backlog - Server Tools Team
            dandv Dan Dascalescu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: