One-line backup command for MongoDB
1 | mongodump --db <dbname> |
One-line drop command for MongoDB Database.
1 | $ mongo <dbname> --eval "db.dropDatabase()" |
Then, we could easily resotre the backup folder that contains both BSON and JSON files.
1 | $ mongorestore <folder_name> --db <dbname> |