Sequelize js

编程入门 行业动态 更新时间:2024-10-21 18:55:56
本文介绍了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

本文发布于:2023-10-13 09:59:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1487640.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Sequelize   js

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!