-
-
Save giiska/da9c5674eeec2f8dfbba to your computer and use it in GitHub Desktop.
Sequelize order findAll result by giving `where in` id array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ids is array | |
var idsCopy = clone(ids); | |
idsCopy.unshift('FIELD', Sequelize.col('id')); | |
db.table.findAll({ | |
where: { id: ids }, | |
order: [[Sequelize.fn.apply(this, idsCopy) ]] | |
}).then(function(users) { | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment