如下图所示,我在cosmos-db中有一个数据集合,我需要按order.id查询这些集合。
{
"id": "0f994473-5288-44e8-8bfd-a19445e6fb51",
"ecom_id": "ECOM005",
"create_date_time": "2018-07-04T05:30:41.6180888+00:00",
"modify_date_time": "2018-07-04T06:14:35.6422331+00:00",
"ecom": "",
"status": "Shipped",
"order": {
"id": 549096652915,
"email": "",
"closed_at": null,
"created_at": "2018-07-04T05:26:26+00:00",
"updated_at": "2018-07-04T05:26:29+00:00",
"number": 347,
"note": null
}
}
我写了以下查询,它给出了错误
SELECT * FROM NovaFulfillments f WHERE f.order.id = 549096652915
答案 0 :(得分:1)
您的order
字段名称与sql语法关键字冲突(例如order,join,select,from等)。这是数据库字段的命名约定。
请在sql下面尝试:
SELECT * FROM NovaFulfillments f WHERE f['order'].id = 549096652915
语法官方文档:https://docs.microsoft.com/en-us/azure/cosmos-db/sql-api-sql-query#EscapingReservedKeywords
希望它对您有帮助。