MongoDB - Create Backup

MongoDB - Create Backup : the way to create a backup in MongoDB.

Dump MongoDB Data

To create backup of database in MongoDB, you ought to use mongodump command. This command will dump the entire information of your server into the dump listing.

There are many options to be had by which you can restriction the amount of records or create backup of your remote server.


There are following simple syntax of mongodump command :


Start your mongod server. Assuming that your mongod server is strolling on the localhost and port eighty,open a command set off and go to the bin directory of your mongodb example and kind the command mongodump Consider the mycol series has the subsequent records.
The command will connect with the server going for walks at and port 80 and returned all records of the server to directory /bin/dump/.

Following is a listing of available options that may be used with the mongodump command.

Syntax Description Example
mongodump --host HOST_NAME --port PORT_NUMBER This commmand will backup all databases of special mongod instance. mongodump --host tutorialspoint.Com --port 27017
mongodump --dbpath DB_PATH --out BACKUP_DIRECTORY This command will backup simplest unique database at exact course. mongodump --dbpath /facts/db/ --out /records/backup/
mongodump --collection COLLECTION --db DB_NAME This command will backup simplest precise collection of certain database. mongodump --collection mycol --db test

Restore statistics

To repair backup information MongoDB's mongorestore command is used. This command restores all of the information from the backup listing.


The primary syntax of mongorestore command is −


Welookups is optimized for learning.Copy right 2018 - 2019 kumar aditya singh .
All Right Reserved and you agree to have read and accepted our term and condition.
All Rights Reserved.