Azure 文档查询子词典
Azure Document Query Sub Dictionaries
我已将以下 JSON 文档存储在 Azure 文档数据库中:
"JobId": "04e63d1d-2af1-42af-a349-810f55817602",
"JobType": 3,
"
"Properties": [
{
"Key": "Value1",
"Value": "testing1"
},
{
"Key": "Value",
"Value": "testing2"
}
]
当我尝试查询文档时,我可以轻松地执行
Select f.id,f.Properties,C.Key from f Join C IN f.Properties where C.Key = 'Value1'
但是当我尝试查询时:
Select f.id,f.Properties, C.Key from f Join C IN f.Properties where C.Value = 'testing1'
我收到无法计算查询的错误。我认为这是由于 'VALUE' 是查询语言中的保留关键字。
我无法在属性数组中指定特定的顺序,因为不同的子类可以根据需要以不同的顺序添加不同的属性。
任何人有任何建议我仍然可以完成此查询吗?
要转义 DocumentDB 中的关键字,您可以使用 []
语法。例如,上面的查询将是:
Select f.id,f.Properties, C.Key from f Join C IN f.Properties where C["Value"] = 'testing1'
我已将以下 JSON 文档存储在 Azure 文档数据库中:
"JobId": "04e63d1d-2af1-42af-a349-810f55817602",
"JobType": 3,
"
"Properties": [
{
"Key": "Value1",
"Value": "testing1"
},
{
"Key": "Value",
"Value": "testing2"
}
]
当我尝试查询文档时,我可以轻松地执行
Select f.id,f.Properties,C.Key from f Join C IN f.Properties where C.Key = 'Value1'
但是当我尝试查询时: Select f.id,f.Properties, C.Key from f Join C IN f.Properties where C.Value = 'testing1'
我收到无法计算查询的错误。我认为这是由于 'VALUE' 是查询语言中的保留关键字。
我无法在属性数组中指定特定的顺序,因为不同的子类可以根据需要以不同的顺序添加不同的属性。
任何人有任何建议我仍然可以完成此查询吗?
要转义 DocumentDB 中的关键字,您可以使用 []
语法。例如,上面的查询将是:
Select f.id,f.Properties, C.Key from f Join C IN f.Properties where C["Value"] = 'testing1'