Model.create and Model.bulkCreate include option doesn't seem to work
See original GitHub issueIssue Creation Checklist
- I understand that my issue will be automatically closed if I don’t fill in the requested information
- I have read the contribution guidelines
Bug Description
BuildOptions
and BulkCreateOptions
have include
, but it doesn’t seem to work as far as I can tell. The docs don’t list that as an option for Model.bulkCreate
but it exists in the BulkCreateOptions
type. It does list it as an option for Model.create
. The docs for the include
parameter say to see the docs for Model#set
, but I don’t see anything in the set
entry that seems to explain that parameter.
Reproducible Example
Here is the link to the SSCCE for this issue: https://github.com/hexpunk/sequelize-sscce/tree/bulk-create-options
What do you expect to happen?
I expect the model instance returned from Model.create
to preload or prefetch the relationships given in the include
parameter of the passed in options object.
What is actually happening?
No relationships are preloaded or prefetched in the returned model instance.
Environment
- Sequelize version: 6.21.0
- Node.js version: v14.19.1
- If TypeScript related: TypeScript version: 4.2.4
- Database & Version: PostgreSQL 11.10 and Sqlite3 v3.39.1 (shipped with sqlite3@5.0.9)
- Connector library & Version: pg@8.7.1 and sqlite3@5.0.9
Would you be willing to resolve this issue by submitting a Pull Request?
- Yes, I have the time and I know how to start.
- Yes, I have the time but I will need guidance.
- No, I don’t have the time, but my company or I are supporting Sequelize through donations on OpenCollective.
- No, I don’t have the time, and I understand that I will need to wait until someone from the community or maintainers is interested in resolving my issue.
Indicate your interest in the resolution of this issue by adding the 👍 reaction. Comments such as “+1” will be removed.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
It’s not about the include being written incorrectly, it’s written correctly. The problem is different:
In this code snippet, the
include
option is not used to select the team after the player has been created. That is not supported. It’s used to create an associated rowThanks ephys! My bad as short sleeper,
I’d keep the issue short and focus the useful conclusion.