1

I had an HDD malfunction on a Mongo node. After running fsck and mongod --repair I was able to dump the needed collection with mongodump and move it to another server.

However, some records appear to be malformed and mongorestore fails with:

assertion: 10331 EOO Before end of object

I restored the collection with mongorestore --noobjcheck and now I want to remove the malformed records from the collection.

How do I do that? Is there a way to force Mongo to check itself or must I do it manually?

1

You can run a --repairDatabase for that node:

mongod --repair --repairpath <repair_path>

Keep in mind that the repair path should have at least as your data size free disk space. (if you have 100GB, the repair path should have at least 100GB free also. That should take care of problems of that sort.

Also, in the future if anything of some sort happen again and you need to run mongodump,
you can run the mongodump --repair.
This will ensure that any corrupted data will not be dumped.

Hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.