How to encode Spring MongoDB data for db.test.update ({name: 'abc'}, {$ pull: {'child': {'age': 10}}})

From the console, I can work as db.test.update ({name: 'abc'}, {$ pull: {'child': {'age': 10}}}.

How to code using spring -data-mongodb in Java for this instruction? I got mongoTemplate. I know that I need to call Update.pull (). But I do not know the details.

Thanks for your reply.

0
source share
1 answer
update.pull("child", new BasicDBObject("age", 10));

mongoOperation.updateMulti(query, update, collectionName);
+4
source

All Articles