mongodb - How to use mongodump for 1 collection -


how use mongodump move 1 collection 1 database another?

how should use command , options?

i think it's just:

mongodump --db=<old_db_name> --collection=<collection_name> --out=data/  mongorestore --db=<new_db_name> --collection=<collection_name> data/<db_name>/<collection_name>.bson 

also see docs here , here.

btw, other way move collection 1 database use renamecollection:

db.runcommand({renamecollection:"<old_db_name>.<collection_name>",to:"<new_db_name>.<collection_name>"}) 

here's related threads:

hope helps.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -