Navigation
This version of the manual is no longer supported. Learn more about upgrading your version of MongoDB.

db.repairDatabase()

On this page

db.repairDatabase()

db.repairDatabase() provides a wrapper around the database command repairDatabase, and has the same effect as the run-time option mongod --repair option, limited to only the current database. See repairDatabase for full documentation.

Behavior

Warning

If you are running with journaling enabled, there is almost never any need to run repairDatabase unless you need to recover from a disk-level data corruption. In the event of an unclean shutdown, the server will be able to restore the data files to a clean state automatically.

Changed in version 2.6: The db.repairDatabase() is now available for secondary as well as primary members of replica sets.