Mongo backup and restore

To take backup of mongodb database

$ monogodb -db database_name > database_name.bson

To restore backup file to database

$ mongorestore -db database_name folder_name

Take backup from heroku MongoHQ using heroku-mongo-sync

$ heroku mongo:pull --app app_name

Take backup from heroku MongoHQ from MongoHQ url

$ mongodump -h hatch.mongohq.com:27021 -d database_name -u admin -p sekret -o ~/tmp/mongodump

Restore heroku MongoHQ database with backup

$ mongorestore -h hatch.mongohq.com:27021 -d database_name -u admin -p sekret ~/tmp/mongodump/database_name