I'm learning mongodb and java and have the following question, is it possible to chain filters?
So my example document in mongo is as follows
{"_id" : "...."
"name" :"Joe",
"roles" : ["A","B", "C"],
"value" : 1000
}
Can i do an update using a filter which will update depending on whether the document in mongo contain the roles
example my
listCriteria = ["B","D","E"]
so update this document if it has the roles B, D, E, update the value to 2000
In java I know I can use filters
Bson filter = Filters.eq("name", "Joe");
Filters.in("roles", roles);
.....
this.collection.updateOne(filter, updatedDocument...)
How can I chain it so that it updates the document with name "Joe" only if the roles in the documents contains atleast one in the list criteria