在这样的 Azure Documentdb 文档中
{
"id": "WakefieldFamily",
"parents": [
{ "familyName": "Wakefield", "givenName": "Robin" },
{ "familyName": "Miller", "givenName": "Ben" }
],
"children": [
{
"familyName": "Merriam",
"givenName": "Jesse",
"gender": "female",
"grade": 1,
"pets": [
{ "givenName": "Goofy" },
{ "givenName": "Shadow" }
]
},
{
"familyName": "Miller",
"givenName": "Lisa",
"gender": "female",
"grade": 8
}
],
"address": { "state": "NY", "county": "Manhattan", "city": "NY" },
"isRegistered": false
};
如何查询以获取宠物名称为“Goofy”的孩子?
看起来下面的语法无效
Select * from root r
WHERE r.children.pets.givenName="Goofy"
相反,我需要做
Select * from root r
WHERE r.children[0].pets[0].givenName="Goofy"
这并不是真正搜索数组。
关于我应该如何处理这些查询的任何建议?