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
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
Post a Comment