
MongoDB Cookbook - Second Edition
By :

In this recipe, we will look at some basic backup and restore operations using utilities such as mongodump
and mongorestore
to back up and restore files.
We will start a single instance of mongod. Refer to the recipe Installing single node MongoDB in Chapter 1, Installing and Starting the Server, to start a mongo instance and connect to it from a mongo shell. We will need some data to backup. If you already have some data in your test database, that will be fine. If not, 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
With the data in the test
database, execute the following (assuming we want to export the data to a local directory called dump
in the current directory):
$ mongodump -o dump -oplog -h localhost -port 27017
Verify that there is data in the dump
directory. All files will be ...
Change the font size
Change margin width
Change background colour