sequelize.js - Sequelize: sort by enum cases -


i have model (article) field (the name type) of type enum('source', 'translated') , return 1 article ordered type field. source articles should returned before translated articles. like:

article.findone(order: [     {         type: [             'source',             'translated'         ]     } ]); 

unfortunately there appears no built-in solution sorting enums. instead have sort by case, couldn't find documentation on how sequelize.

what conventional approach here?

sorting case hard in sequelize, sort field (the second answer in linked post) should possible:

order: sequelize.fn('field', sequelize.col('type'), 'source', 'translated') 

it's supported mysql far know though


Comments

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -