mongorestore --db={{DB_NAME}} --collection={{COLLECTINO_NAME}} {{COLLECTION_BSON_FILE}}
- DB_NAME: DB to get backup from
- COLLECTION_NAME: Collection which needs to be dumped in destination directory
- COLLECTION_BSON_FILE: Location of the collections
bson
file which was generated by mongodump command
mongorestore --db=ak-cli --collection=cli_commands /arshad/ak-cli/db/dump/cli_commands.bson
To drop the collection before importing, add --drop
flag at the end of the command. Something like the below command.
mongorestore --db=ak-cli --collection=cli_commands /arshad/ak-cli/db/dump/cli_commands.bson --drop
- --drop: Drop flag, drops the collection before proceeding with import.