Suppose I have a collection containing documents like :
{name: "a", preferences: ["apples","oranges","bananas"]}
{name: "b", preferences: ["apricots","oranges","strawberries"]}
{name: "c", preferences: ["oranges","plums"]}
{name: "d", preferences: ["apples","plums","oranges"]}
{name: "e", preferences: ["strawberries","bananas"]}
Now there are no more oranges so I want to remove them from all documents and end up with :
{name: "a", preferences: ["apples","bananas"]}
{name: "b", preferences: ["apricots","strawberries"]}
{name: "c", preferences: ["plums"]}
{name: "d", preferences: ["apples","plums"]}
{name: "e", preferences: ["strawberries","bananas"]}
I've been banging my head to know whether, using Spring's mongoTemplate, there is any straightforward way to do this, apart from the obvious (and, I guess, inefficient as the collection is potentially huge) iterative way ? Thanks for your help.