Click here to Skip to main content
15,512,908 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is it possible to remove double quotes from generated query in Sequelize from ranking column?

db.leaderboard.findAll({
            attributes: ['user_id', ['amt_agg', 'amount'], ['dist_agg', 'distance'],
            [sequelize.col('row_number() OVER (ORDER BY (dist_agg) DESC)'),'ranking' ]]
        })

Generated output of above code:-

SELECT "user_id","amt_agg" AS "amount","dist_agg" AS "distance", "row_number() OVER (ORDER BY (dist_agg) DESC)" AS "ranking" FROM "leaderboard" AS "leaderboard";

What I have tried:

Everything is working fine if I remove double quotes(") from ranking column in generated output.
Posted
Updated 29-Apr-18 22:04pm
v2

1 solution

Use Model.ranking

Model is the name of model for example
var Model = models.size
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900