I am using MongoDb Morphia for Java
and I want to pessimistically lock many documents with one command. I am familiar with the findAndModify
method, which will find and update one document. Is there a method that will do the same for multiple documents?
findAndModify()
only works with a single document as defined by the server's behavior. If you're wanting to update multiple documents in one all-or-nothing block, you might consider using a transaction.