本文介绍了Sequelize js - 限制和排序错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 sequelize js 中对查询进行排序的正确方法是什么?
What is the proper way to sort the query in sequelize js?
示例:
db.model.findAll({ where: conditions, order: 'postDate DESC', limit: 10, offset: 0, include: [model1, model2] })plete(function(err, results){console.log(results); });导致拉取limit和offset的结果,先进行排序.在限制结果之前我应该怎么做先排序?
Resulting in pulling the results of the limit and offset, first and then it does the sorting. What should I do to do the sorting first before limiting the results?
以后谁会遇到这个bug,这是修复
in the future who will encounter this bug, this is the fix
order: [["postDate","DESC"]] 推荐答案你必须这样指定:order: [["postDate","DESC"]]
更多推荐
Sequelize js
发布评论