Answers for "how to update mongodb document in spring boot"

1

spring boot mongodb update subdocument

final Query query = new Query(new Criteria().andOperator(
        Criteria.where("_id").is("id"),
        Criteria.where("listA").elemMatch(Criteria.where("_id").is("id"))
));
final Update update = new Update().addToSet("listA.$.listB", stuff).set("listA.$.thing", "thing");
final WriteResult wr = mongoOperations.updateFirst(query, update, "collectionName");
Posted by: Guest on September-15-2020

Code answers related to "how to update mongodb document in spring boot"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language