In this case, the documents look like:
{
"id" : "1",
"Properties" : [
{
"Name" : "Leonard",
"Result" : "Pass",
"Grade" : "A"
},
{
"Name" : "Sheldon",
"Result" : "Pass",
"Grade" : "A"
},
{
"Name" : "Raj",
"Result" : "Fail",
"Grade" : "F"
},
{
"Name" : "Howard",
"Result" : "Pass",
"Grade" : "B"
}
]
}
I want to write a query which returns the elements with the "Result" : "Pass". I have tried ARRAY_CONTAINS() with query
SELECT * FROM d as c WHERE ARRAY_CONTAINS(c.Result, {"Result" : "Pass"}, true)
The Problem with the query is that it returns the whole of the array in as it is able to find "Result": "Pass" in the array. How should I modify or change the query such that the result contains only those elements of the array which has "Result": "Pass".