Azure文档查询子词典

Cra*_*nie 3 azure azure-cosmosdb

我已将以下JSON文档存储在Azure文档数据库中:

"JobId": "04e63d1d-2af1-42af-a349-810f55817602",
"JobType": 3,
"
"Properties": [
  {
    "Key": "Value1",
    "Value": "testing1"
  },
  {
    "Key": "Value",
    "Value": "testing2"
  }
]
Run Code Online (Sandbox Code Playgroud)

当我尝试查询文档时,我可以轻松地执行

选择f.id,f.Properties,C.Key来自f Join C IN f.Properties,其中C.Key ='Value1'

但是当我尝试查询时:选择f.id,f.Properties,C.Key来自f Join C IN f.Properties,其中C.Value ='testing1'

我收到一个错误,无法计算查询.我认为这是由于'VALUE'是查询语言中的保留关键字.

我无法在属性数组中指定特定的顺序,因为不同的子类可以根据需要在不同的顺序中添加不同的属性.

有人建议我怎么还能完成这个查询?

Ara*_* R. 5

要转义DocumentDB中的关键字,可以使用[]语法.例如,上面的查询将是:

Select f.id,f.Properties, C.Key from f Join C IN f.Properties where C["Value"] = 'testing1'
Run Code Online (Sandbox Code Playgroud)