1
我無法查詢DocumentDB中的嵌套對象。我無法控制數據的格式。比方說,一個物體看起來像這樣在DocumentDB:DocumentDB查詢嵌套對象
{
"SCHEMA_ID": {
"PROJECT": "A",
"MODEL": "B",
"GUID":"A GUID"
},
"STATE": {
"Active": "True"
},
"OBJECTS": {
"OBJECT": [
{
"ATTR_VALS": {
"NAME": "Header",
"ID": "0",
"VALUE": [
{
"NAME": "JobId",
"VAL": "1011656"
},
{
"NAM": "Region",
"VAL": "West Coast"
}
]
}
},
{
"ATTR_VALS": {
"NAME": "SampleData",
"ID": "0",
"VALUE": [
{
"NAME": "Height",
"VAL": "5"
},
{
"NAM": "Length",
"VAL": "3"
}
]
}
}
]
}
}
我想找到所有有「ATTR_VALS」 =「的sampleData」,畫在那裏這些項目有一個「高」 = 5
所以遠我有:
SELECT test.GUID
FROM test
join OBJECTS in test.OBJECTS
join OBJECT in OBJECTS
join ATTR_VALS in OBJECT
join VALUE in ATTR_VALS
WHERE ATTR_VALS.NAME = 'SampleData' AND VALUE.NAME='Height' AND VALUE.VAL='5'
但是這不起作用,並且不會返回任何結果。謝謝!
你得到的結果投影子句中必須進行轉義
@AravindRamachandran我得到0個結果。我在.net代碼中運行查詢。沒有連接的類似代碼返回數據正常(如SELECT * FROM test WHERE test.GUID ='GUID') – Jeremy