How can I use mongodump
to move a single collection from one database to another?
How should I use the command and its options?
I think it's just:
mongodump --db= --collection= --out=data/
mongorestore --db= --collection= data//.bson
Also see docs here and here.
Btw, the other way to move the collection from one database to another is to use renameCollection
:
db.runCommand({renameCollection:".",to:"."})
Here's some related SO threads:
Hope that helps.