khex khex - 1 year ago 350
Javascript Question

Sort sequelize.js query by date

.findAll({where: {tag: 'news'}, limit: 10})
.success(function(result) { ... })

How to insert the condition of sorting by date in my query with not using

.findAll({ limit: 10, sort: [updatedAt, descending]})

Answer Source

Here's the syntax:

Post.findAll({ limit: 10, order: '"updatedAt" DESC' })

Here are more examples from the official documentation.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download