我尝试在 NodeJS 中使用 dynamoose 对 DynamoDB 中的项目进行排序
descending() 和 ascending() 是 dynamoose npm 中提供的两个用于排序的函数,但我没有得到这个工作!
最佳答案
您可以在 ONLY Query 中使用降序和升序(它不适用于扫描)。这是我用来查询数据的工作示例。
Devices.query('device_id').eq('123').where('created_at').gt(lastMonth).ascending().exec();
https://dynamoosejs.com/api#queryascending
降序也一样:
Devices.query('device_id').eq('123').where('created_at').gt(lastMonth). descending().exec();
关于node.js - 如何使用 dynamoose 进行排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44540414/