mongodb.png

# Cron jobs
# Dump all databases
3 3 * * * mongodump --out /var/backups/mongobackups/`date +"%m-%d-%y"`
# Find and remove databases older the 7 days
3 1 * * * find /var/backups/mongobackups/ -mtime +7 -exec rm -rf {} \;
# Restore dump
sudo mongorestore --db newdb --drop /var/backups/mongobackups/01-20-16/newdb/

or by bash script:

date=`date +"%m-%d-%y"`
`mongodump --out /var/backups/mongobackups/$date`