Closed bucketheadv closed 7 years ago
Thanks for reporting. The original sequelize typings seem to have the same issue: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/sequelize/index.d.ts#L3243
Additionally I cannot find any possibilities to use strings in order
from the sequelize docs.
Which sequelize version are you using?
I think only array should be allowed, because I believed I've read in the Sequelize docs that order shouldn't be with strings. although it works
@BruceHem You mean it is working with strings? In which sequelize version?
Sequelize v3 order can be used with strings last time I checked.
Yes, but v4 can't any more.
@bucket-sven @BruceHem Thanks.
If it is working on v3, I would suggest to not change the typings for now. When dropping v3 support some day, this issue should be fixed as well.
@RobinBuschmann OK.
I just ran into this problem as well:
Order must be type of array or instance of a valid sequelize method. at Object.getQueryOrders
with sequelize v4.19.0
The docs still has the "string example": http://docs.sequelizejs.com/manual/tutorial/models-usage.html Project.findAll({order: 'title DESC'})
I think this is misleading.
@andineck I ran into it, too.
It looks like the proper way should be:
Project.findAll({order: [sequelize.literal('title DESC')]})
FWIW, I ran into this issue too. Docs should be updated to remove the Project.findAll({order: 'title DESC'})
example that @andineck mentioned earlier.
Still not removed from the docs, +1
Hello,
when I using the
order
option,When I use order as a string, the error below will be thrown:
The
order
's definition is:So, I think it's a bug.