-
Notifications
You must be signed in to change notification settings - Fork 409
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 collStats
to return correct count of documents for SQLite
#3363
Fix collStats
to return correct count of documents for SQLite
#3363
Conversation
Codecov Report
@@ Coverage Diff @@
## main #3363 +/- ##
=======================================
Coverage 74.07% 74.07%
=======================================
Files 413 413
Lines 25306 25315 +9
=======================================
+ Hits 18746 18753 +7
- Misses 5472 5473 +1
- Partials 1088 1089 +1
Flags with carried forward coverage won't be shown. Click here to find out more. |
When I run the same benchmark #3355 (comment) the count is correct.
|
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.
LGTM, but we should understand that collStats
's count
field is an approximation. It might not be correct in MongoDB, too. If we need to know the exact count, we should run count
, not collStats
.
Yes indeed, for mongoDB as far as I can tell, there isn't an indication if it's exact or not. For us, both pg and sqlite are approximation. |
https://www.mongodb.com/docs/manual/reference/operator/aggregation/collStats/ says:
Deprecated https://www.mongodb.com/docs/manual/reference/command/collStats/ says:
So it looks like that |
Thanks for looking into this in detail 🤗! |
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.
That's a helpful improvement! And I also like the test that helps us ensure the number is correct.
Description
Closes #3355.
Readiness checklist
task all
, and it passed.@FerretDB/core
), Milestone (Next
), Labels, Project and project's Sprint fields.