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.
Step 2:
Press Windows + R to open Run and type cmd and click OK button.
Step 2:
Change directory to root using command
cd/
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.
Step 4:
Hit Enter key and wait for it to finish.
Your Mongo database is now repaired
Learn how to start MongoDB in Windows.
Thanks for reading.