Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes a bug in the mongo package that caused a miscount when counting documents while using the aggregation pipeline. I recently installed this in a large production app and caught a couple of bugs that the tests had not.
0f1deb6 - Add
paginate: false
to ensure counting all documents.e6595b8 - Use the pipeline's
$count
operator for better performance.e126577 - Rearrange the pipeline so that it skips and limits before projecting (aka select). Mongo supposedly optimizes the pipeline steps, but its still make sense to me and reads better if we skip/limit before projection.
927f357 - Add 1 missing test from the generic test suite.
Please let me know anything I can do to move this PR through quickly. It is critical bug in a production app and I cannot roll it back easily.