I have a document with a property which is an array of objects. I would like to write a query that filters out objects from the child array. I thought the array_ contains would do the trick but it does not appear to filter the child array.
Query
SELECT Families.id, Families.parents
FROM Families
WHERE ARRAY_CONTAINS(Families.parents, { givenName: "Ben", familyName: "Wakefield" })
Result
[
{
"id": "WakefieldFamily",
"parents": [
{
"familyName": "Wakefield",
"givenName": "Robin"
},
{
"familyName": "Miller",
"givenName": "Ben"
}
]
}
]
Desired Result
[
{
"id": "WakefieldFamily",
"parents": [
{
"familyName": "Wakefield",
"givenName": "Ben"
}
]
}
]
Is this possible with the Cosmos DB SQL API?
Thank you,
Scott