In this recipe, we will look at some basic backup and restore operations using utilities such as mongodump
and mongorestore
to backup and restore files.
We will be starting a single instance of mongod
. Refer to the Single node installation of MongoDB recipe in Chapter 1, Installing and Starting the MongoDB Server, to start a Mongo instance and connect to it from a Mongo shell. We will need some data to back up; if you already have some data in your test database that would be fine, else create some from the countries.geo.json
file available in the code bundle, using the following command:
$ mongoimport -c countries -d test --drop countries.geo.json