MongoDB
mongodump command dumps everything into the directory given by -o argument in BSON format.
mongodump -h ${HOSTNAME} -u ${DBUSER} -p ${DBPASS} -d ${DBNAME} -o /srv/app/mongo
Note that the following expressions are environment variables defined in bash terminal: -h ${HOSTNAME} -u ${DBUSER} -p ${DBPASS} -d ${DBNAME}
mongorestore command reads all BSON files in the directory and restores the database.
mongorestore -h ${HOSTNAME} -u ${DBUSER} -p ${DBPASS} --db ${DBNAME} /srv/app/mongo