I have a collection named pub. Each document contains a array of strings named cocktails, So that :
{"id" : "0", "name" : "My Beautiful Pub", "cocktails" : ["B52", "SexOnTheBeach", "Negroni"]}
Using Spring mongodb, I would delete every "SexOnTheBeach", so that :
{"id" : "0", "name" : "My Beautiful Pub", "cocktails" : ["B52", "Negroni"]}
... every pub document in my "pub" collection cannot contain the "SexOnTheBeach".
I think I should use the new Update().pull() method, but every update doesn't modify my db.
This mongodb query works perfectly, but I don't know how to translate it!
db.pub.update(
{ },
{ $pull: { cocktails: "SexOnTheBeach" } },
{ multi: true })
Ty in advance.