The IN operator checks for equality, so it cannot be used if you are
looking for partial matches.
Though probably not an intuitive solution, the following query should work:
LET items = [
{
"array": [
{ "foo": 1, "bar": 2, "baz": 3 },
{ "foo": 1, "bar": 2 }
]
}
]
FOR item IN items
LET contains = (
FOR ae IN item.array
FILTER MATCHES(ae, [ { foo: 1, bar: 2 } ])
LIMIT 1
RETURN 1
)
FILTER LENGTH(contains) > 0
RETURN item
For outer FOR loop will iterate over each element in "items", and for
each outer element there is a sub-query over the elements in item.array.
If any match is found in it, the subquery will return, and the result is
then post-filtered for matches (think of HAVING in SQL).
Best regards
Jan