Skip to content
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

Use estimated_count instead of size on unfiltered criterias with Mongoid >= 7.2.0 #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kalilz4485
Copy link

With mongoid 7.2.0 comes a change that may bring performances issue to kaminari

The .count method will really count documents when used without filters, instead of using the estimate count stored in the collection https://github.com/mongodb/mongoid/pull/4808/files

kaminari-mongoid uses size which is an alias for count, my approach is to override it to use estimate_count when we can

I didn't add any spec since it's not changing any expected result nor fixing anything

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant