Download the compose.io backup file
Navigate to your compose deployment "Backups" section and download the appropriate backup file.
Setting up the local MongoDB instance
Navigate to the location you saved your compose backup and make a new directory and then untar the backup file into that directory.
$ mkdir db $ tar -xvf 2017-02-14_18-31-37_UTC_production.tar -C db
What you have now is a directory capable of being run as a
Run this next command to startup a mongod instance at the default (27017) port that you'll be able to interact with as any other running mongo instance.
$ mongod --dbpath ./db
Creating a dump file
If you want to create a
dump file from this backup, you can now run. This will run the default dump on the default port to the default
If you prefer to just dump a single collection, single database,
-out directory or other options you can do that with flags here.
mongodump --collection collection --db databasename -o /mydir/
What you have now is a standard
dump directory that contains
.bson files that you can use
mongorestore to restore to an existing database.
Restoring a single collection
Now that you have your dump files, you can drop into your dump directory and restore your collection.
cd into your dump directory and then
cd from there into the correct directory for your database. You should see a list of files for each collection you have with
.bson extensions. From here you can call
mongorestore to restore your database.
mongorestore --host mongodbhost.com --port 27017 -u USERNAME -p PASSWORD --db databasename --collection collection collection.bson