Skip to main content

How do you detect and fix logical inconsistencies across replicas?

Expert MongoDB
Quick Answer Detect replica inconsistencies with db.runCommand({dbHash: 1}) on each member and compare hashes. Use dbCheck (MongoDB 3.6+) for online validation of data consistency between primary and secondaries. Logical inconsistencies from bugs (application wrote wrong data) can't be fixed by MongoDB - require application-level reconciliation. Always use majority write concern to prevent rollback-induced inconsistencies.

Answer

Use db.hashes(), validate(), and CDC systems to detect mismatches. Fix via initial sync, logical rebuild, or selective re-sync.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice