The similar question already have been asked: How to validate a mongorestore

But how to actually validate the documents in mongodumb and mongorestore? And also - can I see the documents that fail validation and why do they fail it?

The commands I am using:

mongodump -d my_database -o ~/dump --gzip
mongorestore --drop --gzip dump

The mongo is of 4.x.x version (4.0.10 and 4.2.0).


If only needing to validate, the best combination would be to add --dryRun --objcheck --verbose or --dryRun --objcheck -vvvvv to your mongorestore command.

When running the command for real, drop the --dryRun.

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.