Created
March 22, 2019 15:53
-
-
Save jordanell/bf21422b28e510c71b41f11df5edf6c4 to your computer and use it in GitHub Desktop.
Sequelize polymorphism eager loading
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Given a comment which has polymorphic associations of post and photo. | |
*/ | |
const comments = await models.Comment.findAll({ | |
include: [ | |
{ model: models.Photo }, | |
{ model: models.Post }, | |
], | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment