Developer details how silent NULL bug passed all checks in MongoDB-to-Postgres migration tool
A developer building mongopg-migrate, an open-source tool for migrating MongoDB collections to PostgreSQL, discovered a critical bug in version 0.2.0 where nested lookup dependencies were only scanned one level deep, causing incorrect entity load ordering. Because a separate on_missing policy was designed to write NULL for genuinely unresolved references, it silently masked every failed lookup caused by the ordering error. Row counts remained unchanged since NULLs do not affect them, and the post-migration validator found no dangling references because the dependent entity had loaded by the time it ran. The result was an entire foreign-key column filled with NULLs while all validation checks falsely reported success. The fix involved recursively traversing all nested explode levels for dependency resolution and adding a guard that refuses to apply the on_missing policy when the referenced entity has loaded zero rows, distinguishing a load-order bug from a genuinely missing reference.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in