Clicky

Spring data mongodb - remove element from array

June 23, 2016

Remove an element from inside an array.

Solution:

Update update = new Update(); AdditionalProperty additionalProperty = new AdditionalProperty(); additionalProperty.setType("remove additional properties with this type"); update.pull("additionalProperty", additionalProperty); mongoClient.updateFirst(query, update, <collection\_name>);