How I Corrupted 2 Million+ DB Records in Prod

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

A migration script to encrypt sensitive user data in MongoDB corrupted over 2 million records by accidentally wiping out unencrypted fields. The bug occurred because MongoDB's $set operation replaces entire nested objects rather than merging properties. Running the migration twice resulted in both encrypted and unencrypted

7m watch time
13 Comments

Sort: