Aug 18th, 2012, 12:44 PM
Spring Data - Mongo - How to update list of documents?
I noticed that Spring's MongoOperations supports bulk insert with insertList method.
Can someone please tell if there is a way to do bulk update?
Here is my scenario
1) I have list of documents added to collection using insertList method
2) Each document has two fields (name, price) and i need to update the price for some of the documents.
I was looking for a way to do a bulk update by passing list of document objects that needs to be updated.
I cannot use updateMulti because field being updated will have different value for each document entity.
Does springdata have anything like updateList (similar to insertList) that can take in Collection as input and updates the entities in database with data passed in the input? basically replace the one in database with new one.