order inside findOrCreate
See original GitHub issueThis does not work:
Purchase.scope(scope).findOrCreate({
where: {
referenceId: 5,
},
order: [["updatedAt", "DESC"]],
});
The typescript error:
Argument of type '{ where: { referenceId: number; }; order: string[][]; }' is not assignable to parameter of type 'FindOrCreateOptions'.
Object literal may only specify known properties, and 'order' does not exist in type 'FindOrCreateOptions'.ts(2345)
Environment
sequelize-typescript: 1.0.0-beta.3 Dialect:
- mysql
- [ X ] postgres
- sqlite
- mssql
- any Dialect library version: pg version 6.4.2 Database version: 9.6.12 Sequelize version: 5.8.10 Node Version: 8.11.4 OS: macOS 10.14.3 TypeScript version: 3.4.3 (or 3.3.3 same issue) Tested with latest release:
- No
- [ X ] Yes, specify that version: 5.8.10
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
How to use findOrCreate in Sequelize - Stack Overflow
In order to avoid this, I would like to do a process to update the database only when the specified userid does not...
Read more >Model Querying - Finders - Sequelize
The method findOrCreate will create an entry in the table unless it can find one fulfilling the query options. In both cases, it...
Read more >.findOrCreate() - Sails.js
This particular criteria should always match exactly zero or one records in the database. 2, initialValues, Dictionary, The initial values for the new...
Read more >need help figuring out why a sequelize findOrCreate(...) works ...
Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, ...
Read more >Model usage - Manual | Sequelize
The method findOrCreate can be used to check if a certain element already exists in the ... In order to do that you...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Looks like FindOrCreateOptions is missing IncludeOptions extend.
@papb @RobinBuschmann from sequelize-typescript the issue in his post: https://github.com/RobinBuschmann/sequelize-typescript/issues/654#issuecomment-515171594