Azure cosmosdb 嵌套数组上的Azure CosmosDB SQL查询

Azure cosmosdb 嵌套数组上的Azure CosmosDB SQL查询,azure-cosmosdb,Azure Cosmosdb,我们的文档结构如下 { "id":"GUID", "customer": { "contacts": [ { "type": "MOBILE", "status": "CONFIRMED", "value": "xxxx" }, {

我们的文档结构如下

{
"id":"GUID",
    "customer": {
            "contacts": [
                {
                    "type": "MOBILE",
                    "status": "CONFIRMED",
                    "value": "xxxx"
                },
                {
                    "type": "EMAIL",
                    "status": "CONFIRMED",
                    "value": "aaaa"
                }
            ],
            "addresses": [
                {

                    "country": "xxx"
                }
            ]
        }
}
并且需要搜索客户->联系人,其中value=aaaa。 我尝试了以下选项

1)  SELECT c.id FROM c
    join customer in c.customer
    join contacts in c.customer.contacts
    where contacts.value = "aaaa"

2) SELECT c.id FROM c WHERE c.customer.contacts[0].value= "aaaa"

获取语法错误400错误请求任何高度赞赏的帮助

问题的一部分在于无法像搜索其他属性那样轻松地搜索值。以下是可能的解决方案:

SELECT c.id FROM c
join contacts in c.customer.contacts where contacts["value"] = "aaaa"

SELECT c.id FROM c WHERE c.customer.contacts[1]["value"] = "aaaa"


谢谢@AlexAIT,你的提问很有魅力。我不知道限制,JSON属性名为“value”。