What is the proper way to sort the query in sequelize js?
example:
db.model.findAll({
where: conditions,
order: 'postDate DESC',
limit: 10,
offset: 0,
include: [model1, model2]
}).complete(function(err, results){console.log(results); });
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?
in the future who will encounter this bug, this is the fix
order: [["postDate","DESC"]]
You have to specify it like this: order: [["postDate","DESC"]]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With