Eager loading associations when calling create() or save()
Let's say I have a Customer model that belongs to a User. I saw this on the documentation for create method: ``` [options.include] Array an array of include options - Used to build prefetched/included model instances ``` Source - http://docs.sequelizejs.com/en/latest/api/model/#createvalues-options-promiseinstance But when I tried it, its not eager loading the associated User. ``` Comment.create({ body: inputs.body, UserId: inputs.userId, }, { include: [User] }).then(function(comment) { // comment.User is undefined }); ``` is this a bug? Or I misunderstood the use of `options.include` for the create method?
Posted by johnnncodes on May 27, 2015, 5:35 AM
Tags
Related issues
- struct's lifetime requirements can be bypassed via covariant field assignment
- Proposal to Reorganize the Moderation Team and Review Moderation Policies
- Progressive FPS degradation appears to be related to dota2.com — blocking the domain prevents the performance loss
- proposal: container/...: generic collection types
- Better Custom Endpoint BYOK
- A concrete policy for backward compatibility until Godot 5.0
Raise real-world problems, find people facing the same issue, and discuss solutions.7,000 issues0 comments
github (Other)
struct's lifetime requirements can be bypassed via covariant field assignment
Proposal to Reorganize the Moderation Team and Review Moderation Policies
Progressive FPS degradation appears to be related to dota2.com — blocking the domain prevents the performance loss
proposal: container/...: generic collection types
Better Custom Endpoint BYOK
A concrete policy for backward compatibility until Godot 5.0
New MTP models not supported
Tracking: 429 / Capacity Issues
Eager loading associations when calling create() or save()
Let's say I have a Customer model that belongs to a User. I saw this on the documentation for create method: ``` [options.include] Array an array of include options - Used to build prefetched/included model instances ``` Source - http://docs.sequelizejs.com/en/latest/api/model/#createvalues-options-promiseinstance But when I tried it, its not eager loading the associated User. ``` Comment.create({ body: inputs.body, UserId: inputs.userId, }, { include: [User] }).then(function(comment) { // comment.User is undefined }); ``` is this a bug? Or I misunderstood the use of `options.include` for the create method?
Comments (0)
No comments yet. Start the discussion.