New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: count just the right number of row #304
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks. Please add relevant tests as well.
I'm not really into tests but I did my best to understand how to do that. Is it okay or do I need to explicit something else? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, it works with older sequelize versions, as well?
Don't tested, but I found from the Sequelize docs that the feature that I have applied ( They wrote that if an |
Thank for your investigation. |
Apply a more explicit count of data for the pagination, normally there's no problem but when doing an
include
in the default scope will be counted the included data for each record. For example:By having those two models
and they have a relation like this
When trying to get all users with this defaultScope
The count value is equal to the number of auths that are related to each user returned.
See this SandBox for a working sample.
Fix for #302