Data backup is very important in any case. If you are storing data somewhere, you should definitely create a backup of the data. These backups are your life buoy that you will hug in case of any problem.
In MongoDb, one of our data backup methods is mongodump. By using this tool, we provide backup.
Let’s examine the working methods step by step;
How do I backup a MongoDB database?
In the following command, we determine the database that we will back up with the -db parameter. With the –out parameter, we specify the location of this dump.
mongodump --db test --out /tmp/mongobackup
How do I backup all MongoDB databases?
If we want to create backups of all the db’s in the server, we need to specify the location only with the -out parameter without writing the -db parameter.
mongodump --out /tmp/mongobackup