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

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

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -