Say there are 2 active transactions A
and B
(both are active, thus not yet committed). First, A
does findAndModify
on a random document matching the predicate and keeps the transaction active. Now B
does the same findAndModify
and happens to land on the same document. What happens now? Is B
blocked until A
ends?
If so, is there a way to let B
pick another document which also matches the given predicate, but which is not locked by a concurrent session? In SQL, this would be a SKIP LOCKED
directive.