How to repair MongoDB using command prompt in windows

repair mongodb using command prompt

Sometimes the Mongo database starts showing error when your system accidentally gets shut down. Here I will explain way to repair MongoDB database using Command Prompt in Windows.

Step 1:

Go to C directory and create a folder on root named data.

2018-04-27_0132

Step 2:

Press Windows + R to open Run and type cmd and click OK button.

2018-04-27_0127

Step 2:

Change directory to root using command

cd/

2018-04-27_0129

Step 3:

Type the Full Path of mongod.exe service. Check your installation directory of MongoDB. In my case, the installed directory is Program Files (x86)

"Program Files (x86)\MongoDB\Server\3.0\bin\mongod.exe" --dbpath C:\data --repair

Notice the parameter –repair is added in the command.

2018-04-27_0137

Step 4:

Hit Enter key and wait for it to finish.

Your Mongo database is now repaired

2018-04-27_0139

 

Learn how to start MongoDB in Windows.

Thanks for reading.

Leave a Reply

Your email address will not be published. Required fields are marked *