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

mongorestore --uri still asks for a database

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 4.0.4
    • Component/s: mongorestore
    • None
    • Environment:
      Ubuntu 16

      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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            dandv Dan Dascalescu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: