mongodbHow to backup a MongoDB database?
Backup of a MongoDB database can be done using the mongodump
command. This command will create a binary dump of the contents of the database.
Example
mongodump --db mydb --out /data/backup/
This command will create a backup of the mydb
database in the /data/backup/
directory.
The mongodump
command has several options that can be used to customize the backup process. These include:
--db
: Specify the database to backup--collection
: Specify the collection to backup--out
: Specify the output directory--query
: Specify a query to filter the documents to backup
For more information, please refer to the MongoDB documentation.
More of Mongodb
- How to check the version of MongoDB?
- How to use watch in MongoDB?
- How to list MongoDB users?
- How to remove a field from MongoDB?
- How to create a many to many relation in MongoDB?
- How to use MongoDB queue?
- What is MongoDB default port?
- How to update an array element in MongoDB?
- How to select specific fields in MongoDB query?
- How to check if array is empty in MongoDB?
See more codes...