Suppose I have documents like this:
{
"_id", "1",
"myarray": [
{
"address": "abc",
"role": "input",
}
{
"address": "def",
"role": "output",
}
]
},
{
"_id", "2",
"myarray": [
{
"address": "xyz",
"role": "input",
}
{
"address": "abc",
"role": "output",
}
]
}
I want to return documents where myarray.address is abc and myarray.role is output, but not the documents where exists myarray.address='abc' and exists myarray.role='output', but the documents where exists element of myarray array:
address: "abc",
role: "output"
Using the example above, I want only the document with _id=2.