We’ll use mongodump to export our database

Export all databases

Run the following command:


Export to certain directory

We can set the out directory to the exported database using the --out flag:

mongodump --out backup-directory-path

For example

mongodump --out /mongodb-backups

Export single database

To export only certain database use the flag --db

mongodump --db my-db-name 

Export it to certain directory name:

mongodump --db my-db-name --out path-to-backup-directory
mongo series1 - Run MongoDB in the background2 - Create root user in MongoDB3 - Default Config File Path4 - Create Daily Backup For MongoDB Databases5 - Default path of config file in MongoDB6 - List All Databases In MongoDB7 - Delete OR Drop Database In MongoDB8 - How to export or dump database in MongoDB9 - How Import or restore database In MongoDB10 - List all collections in database with its size11 - Delete Database Collection from database12 - Delete Database Collection documents from database