Is it possible to run queries on array elements? Seems like it works ok on the top level items... Lets say I have this json:
{
"_id": "5769cfbf7e45b52e388bbc78",
"address": {
"street": "2 Avenue",
"zipcode": "10075",
"building": "1480",
"coord": [
73.9557413,
40.7720266
]
},
"borough": "Manhattan",
"cuisine": "Italian",
"grades": [
{
"date": "2014-10-01T00:00:00.000Z",
"grade": "A",
"score": 11
},
{
"date": "2014-01-06T00:00:00.000Z",
"grade": "B",
"score": 17
}
],
"name": "Vella",
"restaurant_id": "41704620"
}
Is it possible to use JSON_QUERY / JSON_VALUE to do a where clause against grades[xxx].score? I.e. I want to return all documents where ANY of the grades.score is >= 17.
OPENJSON. I don't have SQL Server 2016 available, so I can't really help any further than that.