我需要从特定的集合中获取最新的100个文档,所以我使用了搜索功能和_kuzzle_info中的created来根据文档的创建日期对文档进行排序,但我认为嵌套项目有问题,因为created在_kuzzle_info中。下面是我的代码:
var lastHundred = await kuzzle.document.search("myIndex", "myCollection",
{
query: {
},
sort: {
"_kuzzle_info.created": {
mode: "max",
order: "asc",
nested_path: "_kuzzle_info"
}
}
})我在互联网上找遍了,但没有找到如何在排序选项中使用_kuzzle_info
发布于 2020-10-28 15:57:20
Kuzzle metadata存储在每个文档的_kuzzle_info属性中:
{
createdAt: '<timestamp>',
author: '<kuid>',
updatedAt: '<timestamp>',
updater: '<kuid>'
}在您的代码片段中,您试图使用_kuzzle_info.created属性进行排序,但您应该使用_kuzzle_info.createdAt。
https://stackoverflow.com/questions/64558792
复制相似问题