Include merge options in chain find count #386
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 change will not affect any existing results, however the use of such a feature looks like it's only compatible with SQL databases. I included a test case but I could not get it to pass on MongoDB (as such I have commented it out, but these tests will pass on MySQL, Postgres, and SQLite).
I was doing a chain find filter to do 2 separate queries: 1 would fetch a count of all results, one would use the exact same chain find data and do a count on it (for pagination reasons). While the regular .find() was returning the correct results (8 results), the count would return incorrect results since the merge information was absent (24 results), throwing off the pagination count data. This simple change will take that into account.