
How to take backup and restore backup in MongoDB
How to take backup in mongoDB
- Create Backups from Non-Local mongodb Instances
mongodump --uri=mongodb+srv://<PROJECT_NAME_ON_MONGO_ATLAS>.ppmkd.gcp.mongodb.net/<YOUR_DATABASE_NAME> --username=<YOUR_USER_NAME> --password=<YOUR_PASSWORD> --out=<PATH_TO_SET_BACK_UP> --gzip
- Create backup from local
mongodump --uri=mongodb://localhost:<YOUR_PORT>/<DB_NAME> --out=./ --gzip
How to restore backup in mongoDB
- Restore to remote
mongorestore --uri=mongodb+srv://<PROJECT_NAME_ON_MONGO_ATLAS>.ppmkd.gcp.mongodb.net/<YOUR_DATABASE_NAME> --db=<YOUR_DATABASE> --username=<YOUR_USER_NAME> --password=<YOUR_PASSWORD> --gzip <PATH_TO_FOLDER_THAT_CONTAINS_BACKUP>
- Restore to local
mongorestore --uri=mongodb://localhost:<YOUR_PORT> --db=<DB_NAME> --gzip <PATH_TO_FOLDER_THAT_CONTAINS_BACKUP>
Related articles
Demystifying the Core: Node.js Internal Caching Mechanisms Explored
Dive deep into the internal caching mechanisms of Node.js to understand how it optimizes performance and how developers can leverage these mechanisms in their applications.
Leveraging Rust for High-Performance Node.js Addons in 2025
Explore how integrating Rust with Node.js can unlock unparalleled efficiency and performance for your applications, making them future-ready for 2025.
10 Steps to Mastering Modular Design in Node.js for Scalable Codebases
Explore the transformative power of modular design in Node.js applications to build scalable, maintainable, and efficient codebases for the future.