Azure cosmosdb 嵌套对象子对象的Cosmos DB SQL API查询
我想找到一种更好的方法来搜索集合中的文档是否具有数组中元素超过0的属性,即任何非空的属性Azure cosmosdb 嵌套对象子对象的Cosmos DB SQL API查询,azure-cosmosdb,azure-cosmosdb-sqlapi,Azure Cosmosdb,Azure Cosmosdb Sqlapi,我想找到一种更好的方法来搜索集合中的文档是否具有数组中元素超过0的属性,即任何非空的属性 such as: select * from c where c.property = 'x' and array_length(c.child) > 0 and array_length(c.child.grandchild) > 0 第一个排列长度有效。用这个点符号加上第二个,和我在其他地方读到的不一样。我怎样才能确保我能做到这一点。孙辈将位于0到多个数字之间的任意位置,其数组长度大于0
such as: select * from c where c.property = 'x' and array_length(c.child) > 0 and array_length(c.child.grandchild) > 0
第一个排列长度有效。用这个点符号加上第二个,和我在其他地方读到的不一样。我怎样才能确保我能做到这一点。孙辈将位于0到多个数字之间的任意位置,其数组长度大于0
如果需要更多说明,请告诉我。请使用以下sql:
SELECT distinct c.id,c.name,c.child FROM c
join child in c.child
where array_length(c.child) > 0
and array_length(child.grandchild) > 0
我的样本文件:
[
{
"id": "1",
"name": "Jay",
"child": [
{
"name": "A",
"grandchild": [
{
"name": "A1"
},
{
"name": "A2"
}
]
},
{
"name": "B",
"grandchild": [
{
"name": "B1"
},
{
"name": "B2"
}
]
}
]
},
{
"id": "2",
"name": "Tom",
"child": [
{
"name": "A",
"grandchild": []
},
{
"name": "B",
"grandchild": []
}
]
}
]
希望对您有所帮助。您好,有什么进展吗?mongodb语法如何?