Is there a findAndModify that returns many documents in MongoDb Morphia

38 Views Asked by At

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?

1

There are 1 best solutions below

0
evanchooly On BEST ANSWER

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.