摘要:如何根据注册日期对所有项目进行排序。当我尝试时,它没有输出,我的代码如下所示
代码示例:
abcdschema.statics.fetchall = function fetchall(cb) {
var id_temp='abcd';
this.query('id').contains(id_temp).where('regDate').ascending(function(err,res){
console.log(err,res);
})
}模式
id: {
type: String,
required: true,
hashKey: true
},
name: {
type: String,
required: true,
rangeKey: true
},
regDate: { type: Date, required: true, default: Date.now },
activeFlag: { type: Boolean, default: true }环境:
发布于 2018-10-09 16:51:59
这里没几个问题。
Query.exec()传递回调函数,而不是将其传递给升序函数。Query.eq()作为哈希键。index属性,并使用rangeKey属性对其进行排序。有关如何执行降序查询的详细信息,请参阅测试中的这条线和这条线。https://stackoverflow.com/questions/52712219
复制相似问题