我正在尝试使用Dynamoose获取 table 的最新行。
我阅读了query().ascending()
and query.descending()
,但据我了解,我需要查询整个表,这要求 hashkey 为空。scan()
不支持排序。
就像是:
MyModel
.scan() // 1. scan the whole table
.descending('my_date') // 2. sort by descending by a date
.limit(100) // 3. limit the results to 100
.exec(function(error, data) {
// return error or data
});
有谁知道如何获得最新的行?
提前致谢!