Conversation
the comment should be two way scoping to prevent excess eagerLoading when using Comment.findAll, with this it only include the specific commentableType
|
That will only work when eager loading, but will break all lazy-loaders. I do not recommend doing this. I also don't see what this fixes. Could you provide a query that does not behave as expected? |
|
@ephys it added these 3 lines when using Rating.findAll , which prevent all three included rateableType to find together when id = xxx , because theres always all three rateableType result come out together for each rating, but it should be just one, which i think this will affect the performance |
|
There is a warning about it in the new documentation: https://648dd325deb93b14ad86d83a--sequelize-site.netlify.app/docs/v7/associations/polymorphic-associations/#single-model-single-foreign-key-polymorphic-associations But the proposed solution is unfortunately not something we can put in our documentation, as it will only lead to more issues Right now the best we can do is copy that warning in the Sequelize 6 documentation |

the comment should be two way scoping to prevent excess eagerLoading when using Comment.findAll, with this it only include the specific commentableType