[SERVER-204] mongorestore does not honor -d (--db) flags Created: 30/Jul/09  Updated: 12/Jul/16  Resolved: 15/Sep/09

Status: Closed
Project: Core Server
Component/s: Tools
Affects Version/s: 0.9.6, 0.9.7
Fix Version/s: 1.1.1

Type: Bug Priority: Major - P3
Reporter: Travis Petticrew Assignee: Michael Dirolf
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

All


Participants:

 Description   

mongorestore --help shows that the -d and --db option should set the "database to use."

In tools/Tool.cpp this parameter maps to the instance variable _db and this variable is not referenced in tools/restore.cpp. After further digging I see that the target database used is always that of the dumped database and the d(-db) option is always ignored for this task.



 Comments   
Comment by Michael Dirolf [ 15/Sep/09 ]

should be available in master / tonight's nightly.

if you specify a db (-db) then your root dir (-dir) must point to a backup dir of a single database (a directory containing only .bson files)

Comment by Eliot Horowitz (Inactive) [ 11/Sep/09 ]

if there are 2 databases specified, then -d should be illegal and generate an error

Comment by Michael Dirolf [ 11/Sep/09 ]

I'm not sure what the expected behavior here is. If I do:
mongodump -d "foo"
then:
mongorestore -d "bar"
I'd expect the contents of the db "foo" to be restored as the db "bar"

What about in the case where I do the default, which is:
mongodump -d *
when there are two databases, "foo" and "bar"

What should mongorestore -d "baz" do?

Generated at Thu Feb 08 02:53:22 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.