For our software I need a mongodb filter to filter specific documents from the database. Here is an example, how my data looks like:
[
{
"_id": "v4fv654vae65",
"Title": "Title 123",
"Array": [
"Value1",
"Value2"
]
},
{
"_id": "f46vrwe6vg",
"Title": "Title 456",
"Array": [
"Value3",
"Value1",
"Value2"
]
}
]
Now I need a filter which filters the Array. The filter have to check only the values "Value1" AND "Value2". I dont want the document with the value: "Value3".
My current filter looks like this:
.find({ "Array": {$in: ["Value1", "Value2"]}})
This filter works nearly, but also returns the doucment with the "Value3" field in the array.