{"action":"created","issue":{"url":"https://api.github.com/repos/mongodb/mongo-tools/issues/61","repository_url":"https://api.github.com/repos/mongodb/mongo-tools","labels_url":"https://api.github.com/repos/mongodb/mongo-tools/issues/61/labels{/name}","comments_url":"https://api.github.com/repos/mongodb/mongo-tools/issues/61/comments","events_url":"https://api.github.com/repos/mongodb/mongo-tools/issues/61/events","html_url":"https://github.com/mongodb/mongo-tools/pull/61","id":144200782,"number":61,"title":"TOOLS-1120 Add option targetDb to mongorestore when use option archive","user":{"login":"ArthurHlt","id":5410858,"avatar_url":"https://avatars.githubusercontent.com/u/5410858?v=3","gravatar_id":"","url":"https://api.github.com/users/ArthurHlt","html_url":"https://github.com/ArthurHlt","followers_url":"https://api.github.com/users/ArthurHlt/followers","following_url":"https://api.github.com/users/ArthurHlt/following{/other_user}","gists_url":"https://api.github.com/users/ArthurHlt/gists{/gist_id}","starred_url":"https://api.github.com/users/ArthurHlt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArthurHlt/subscriptions","organizations_url":"https://api.github.com/users/ArthurHlt/orgs","repos_url":"https://api.github.com/users/ArthurHlt/repos","events_url":"https://api.github.com/users/ArthurHlt/events{/privacy}","received_events_url":"https://api.github.com/users/ArthurHlt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-29T09:02:59Z","updated_at":"2016-05-09T16:29:56Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mongodb/mongo-tools/pulls/61","html_url":"https://github.com/mongodb/mongo-tools/pull/61","diff_url":"https://github.com/mongodb/mongo-tools/pull/61.diff","patch_url":"https://github.com/mongodb/mongo-tools/pull/61.patch"},"body":"When we use the option archive it could be nice to de-archive just one database inside another database which have a different name.\r\n\r\nThe actual use case is this one:\r\n1. I have a mongo database created by a SaaS, this service give one database\r\n2. I dump this database as an archive (Archive is used because of the necessity to dump it as a stream using stdout)\r\n3. I want to restore my database to a new created database created from SaaS wich have a different database name than the original one\r\n4. I'm blocked cause it's not possible with `--archive` option when restoring, it wants to create a database with the name from the original database which is not possible to use\r\n\r\nBehavior of the option `--targetDb` in mongorestore:\r\n- this can only be used when using `--archive` option\r\n- This option make mongorestore to restore just one database at once\r\n- If you have more than one database in archive and user use `--targetDb` it will fail, in this case it will ask to set also the option `--db`\r\n- else mongorestore will take the only database set in archive and restore it in the database set in `--targetDb`\r\n\r\nFor the test, i didn't any test cause I don't see ad to add them, it seems to have no canvas to make this test. It should be in `mongorestore_test.go` but there is no relevant place for this because `--archive` option doesn't seem to be tested"},"comment":{"url":"https://api.github.com/repos/mongodb/mongo-tools/issues/comments/217915653","html_url":"https://github.com/mongodb/mongo-tools/pull/61#issuecomment-217915653","issue_url":"https://api.github.com/repos/mongodb/mongo-tools/issues/61","id":217915653,"user":{"login":"bompus","id":253635,"avatar_url":"https://avatars.githubusercontent.com/u/253635?v=3","gravatar_id":"","url":"https://api.github.com/users/bompus","html_url":"https://github.com/bompus","followers_url":"https://api.github.com/users/bompus/followers","following_url":"https://api.github.com/users/bompus/following{/other_user}","gists_url":"https://api.github.com/users/bompus/gists{/gist_id}","starred_url":"https://api.github.com/users/bompus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bompus/subscriptions","organizations_url":"https://api.github.com/users/bompus/orgs","repos_url":"https://api.github.com/users/bompus/repos","events_url":"https://api.github.com/users/bompus/events{/privacy}","received_events_url":"https://api.github.com/users/bompus/received_events","type":"User","site_admin":false},"created_at":"2016-05-09T16:29:56Z","updated_at":"2016-05-09T16:29:56Z","body":"+1 to have this fixed. Didn't fully review the PR, but the core problem needs to be solved either way."}}