spring boot mongodb update subdocument

Solutions on MaxInterview for spring boot mongodb update subdocument by the best coders in the world

showing results for - "spring boot mongodb update subdocument"
Solène
25 Oct 2017
1final Query query = new Query(new Criteria().andOperator(
2        Criteria.where("_id").is("id"),
3        Criteria.where("listA").elemMatch(Criteria.where("_id").is("id"))
4));
5final Update update = new Update().addToSet("listA.$.listB", stuff).set("listA.$.thing", "thing");
6final WriteResult wr = mongoOperations.updateFirst(query, update, "collectionName");