【发布时间】:2019-07-10 09:25:32
【问题描述】:
我有一个包含类似于以下文档的集合:
{
"_id": ObjectId("5cde558555555"),
"liftId": "b227eb28a555",
"timestamp": 1558108800000
}
我通过azure CLI 将以下索引策略应用于上述集合:
{
"indexingMode": "consistent",
"automatic": true,
"includedPaths": [
{
"path": "/liftId/?",
"indexes": [
{
"kind": "Hash",
"dataType": "String",
"precision": 3
}
]
},
{
"path": "/timestamp/?",
"indexes": [
{
"kind": "Range",
"dataType": "Number",
"precision": -1
}
]
}
],
"excludedPaths": [
{
"path": "/"
}
]
}
但是当我尝试使用 sort 查询数据库以获取 timestamp 时,它会失败并出现以下错误:
Error: error: { "_t" : "OKMongoResponse", "ok" : 0, "code" : 2, "errmsg" : "Message: {\"Errors\":[\"The index path corresponding to the specified order-by item is excluded.\"]}\r\nActivityId: }
【问题讨论】:
-
正如我在我的策略文件中提到的,我已经提供了一个
range过滤器
标签: azure-cosmosdb azure-cosmosdb-mongoapi