Sign Up

Sign In

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What is the capital of Egypt? ( Cairo )

You must login to ask a question.

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Backup and Restore MongoDB

Backup MongoDB Database

Backing up all MongoDB databases can be accomplished by running the following command.

mongodump

This will create a “dump” directory in the current working directory containing all available databases. Here is an example of a single database requiring user credentials being backed up.

mongodump -u username -p password -d mydatabase

The -p parameter without a password argument will prompt for the user password.

Restore MongoDB Database

Previously backed up databases can be restored by specifying the path to the existing “dump” directory.

mongorestore ./dump

A single database backup may need to be restored over an existing database and the existing collections automatically replaced. Use the –drop parameter with caution.

mongorestore --drop ./dump/my_database

Hits: 1

Leave a comment

What is the capital of Egypt? ( Cairo )