Backup/restore a database

Backup the database

mongodump --db=database-name

Creates a directory “dump”, which contains a folder with the db name. And this director contains the backup files of all collections. With “–out=” you can specify where you want the backup to be stored.

Restore the database

mongorestore --db=database-name dump/