-
Type: Bug
-
Resolution: Unresolved
-
Priority: 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.