Lesson 2: Backup Tools / Learn

Code Summary: Backup Tools

Review the following code, which demonstrates how to use the mongodump tool.

The following command creates a backup of the sample_analytics database running at the URI "mongodb+srv://dbaTestAdmin@cluster1.xwgj1.mongodb.net/", and zips the file by using --gzip to compress a file called backup.gz.

 mongodump \
 -v \
 --gzip \
 --archive=backup.gz \
 "mongodb+srv://dbaTestAdmin@cluster1.xwgj1.mongodb.net/sample_analytics"

The following options can be used with the mongodump command. Check out the MongoDB documentation for more information.

 --out
 --db
 --collection
 --readPreference
 --gzip
 --archive
 --oplog