Empirically it seems that flush()
is not necessary after findAndUpdate()
, I just couldn't find this explicitly stated anywhere in the Doctrine ODM/MongoDB docs (and I didn't bother to read much source code).
The findAndModify
docs on mongodb.org state
This command can be used to atomically modify a document (at most one) and return it.
And Doctrine MongoDB's findAndUpdate()
uses MongoDB's findAndModify
. So it sounds like the whole thing does indeed happen in one go, so calling flush()
on the document manager shouldn't be necessary.