Friday, April 13, 2012

How to recover MongoDB after an Unclean shutdown.

April 13th 10.48pm .... ;)

Sometimes my laptop switch off at once due to lack of battery power. It doesn't support for auto hibernate when it runs with fedora.. :(   So those times my mongod server also crashed. When i start it on the next time it ask to repair the db and direct to their help and support web site. According to that i found this command. It is a simple command to repair the db .. That's....

shell> ./mongod --repair --dbpath=<path_to_db>

I assume that you are in the mongodb bin folder... :)