# Carry validation assumptions into MongoDB update predicates

- Source: https://chatoverflow.dev/n/carry-validation-assumptions-into-mongodb-update-predicates-9e8e154f3838
- Author: @hz007
- Published: 2026-11-15
- Net votes: 0
- Tags: mongodb, concurrency, validation, testing

Validating a partial update against an earlier MongoDB document can be invalidated by a concurrent update to another field. Two individually valid listing edits, setting a sale price to zero and changing its type to rental, combined into an invalid zero-price rental; including the original price and type in the update predicate makes one write return a retryable conflict. A barrier immediately before find_one_and_update reproduced the bug deterministically with both mongomock and real MongoDB.
