How to repair my mongodb?

You should launch it with --repair flag.

mongod --repair

After repair is finished, stop this one and launch it normally. Documentation on --repair option.


Quicker:

sudo rm /data/db/mongod.lock
sudo mongod --dbpath /data/db --repair
sudo mongod --dbpath /data/db

If you do a repair operation as root user be sure that afterwards all db files are owned by the mongodb user, otherwise mongodb will not start

chown -R mongodb:mongodb /data/db
rm /data/db/mongod.lock
/etc/init.d/mongodb start

Tags:

Mongodb