Originally published at https://jasonwatmore.com
The mongodump
command will create a backup / dump of the MongoDB database with the name specified by the --db [DB NAME]
argument.
The --out /var/backups/`date +"%Y%m%d"
argument specifies the output directory as /var/backups/[TODAY'S DATE]
e.g. /var/backups/20190903
.
sudo mongodump --db [DB NAME] --out /var/backups/`date +"%Y%m%d"`
The mongorestore
command restores a database to the destination --db [DB NAME]
from the specified directory, e.g. /var/backups/20190903
.
sudo mongorestore --db [DB NAME] /var/backups/[BACKUP FOLDER NAME]
Thanks for reading ❤
If you liked this post, share it with all of your programming buddies!
Follow us on Facebook | Twitter
☞ MongoDB - The Complete Developer’s Guide
☞ The Complete Developers Guide to MongoDB
☞ Learn MongoDB : Leading NoSQL Database from scratch
☞ Learn NoSQL Databases - Complete MongoDB Bootcamp 2019
☞ MongoDB Connection Initialization – Node.js API with TDD Tutorial
☞ Building a simple app using NodeJS, MongoDB, and ExpressJS
☞ Node, Express, React.js, Graphql and MongoDB CRUD Web Application
☞ Building REST API with Nodejs / MongoDB /Passport /JWT
#mongodb #database #web-development