如何在CosmosDB SqlAPI中用破折号查询属性



查询:我想得到所有出生在三月的人的记录列表。

{
"details": {
"state": "CA",
"city": "San Fransisco",
"date-of-birth": { // there is a "-" in the key
"month": "March",
"year": "2000"
}
},
"personId": "person1",
"id": "id1"
},
{
"details": {
"state": "CA",
"city": "San Jose",
"date-of-birth": { // there is a "-" in the key
"month": "April",
"year": "2000"
}
},
"personId": "person2"
"id": "id2"
}

我本来希望SQL查询是这样的,但出现了一个错误:

select * from c where c.details['date-of-birth'['month']] = "March"

有人能帮我解决这个问题吗?我确实试着看了一下医生,但有点困惑。

试试这个

select * from c where c.details['date-of-birth'].month = "March"

最新更新