mongodb backup & restore
-
Backup to folder "databasename-DATE"
mongodump --db databasename --out databasename-$(date +'%m-%d-%y')
Restore
mongorestore --db databasename --drop databasename-DATE/databasename mongorestore --db databasename databasename-DATE/databasename
--drop : we’ll make sure that the target database is first dropped so that the backup is restored in a clean database