Tag Archives: Backup

Backing up and Restoring with MongoDB

Dump You can dump the database locally using the following mongodump: mongodump --host DATABASE_HOST --port PORT -d YOUR_DATABASE_NAME -u YOUR_DB_USERNAME -p YOUR_DB_PASSWORD This will create a dump folder containing a subfolder named after your database. The default port for MongoDB is 27017. Import You can import the same dump to a local MongoDB instance using something like the following mongorestore after changing into the dump directory: mongorestore --host DATABASE_HOST --port PORT -d DATABASE_NAME_TO_IMPORT_TO --drop DATABASE_NAME_TO_IMPORT_FROM Note: This will drop the collections in the DATABASE_NAME_TO_IMPORT_TO database before restoring the same collections from your database dump.
Read More
May 30, 2014 1 min read