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

feat(model+query): support options parameter for distinct() #14772

Merged
merged 4 commits into from
Aug 8, 2024

Conversation

vkarpov15
Copy link
Collaborator

Fix #8006

Summary

Make it easier to use distinct() with transactions, so you don't need to chain setOptions(). distinct() looks to be the only query function where you can't pass in options.

Examples

@vkarpov15 vkarpov15 added this to the 8.6 milestone Aug 1, 2024
Copy link
Collaborator

@hasezoey hasezoey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but the options parameter still needs to be added to the query types (currently only in the model's types) and a similar test to using options parameter for distinct on query should likely be in for Model too, or is the transaction test enough?

As a note, the Model.distinct and Query.prototype.distinct have differing options checks, is this intentional?

test/docs/transactions.test.js Outdated Show resolved Hide resolved
@vkarpov15 vkarpov15 requested a review from hasezoey August 8, 2024 00:06
@vkarpov15
Copy link
Collaborator Author

Thanks for the suggestions @hasezoey , I've implemented them both. Added options param to query distinct() types and removed the typeof options === 'object' check in Query.prototype.distinct (and countDocuments() + estimatedDocumentCount() for consistency)

@vkarpov15 vkarpov15 merged commit d6853b8 into 8.6 Aug 8, 2024
51 checks passed
@hasezoey hasezoey deleted the vkarpov15/gh-8006 branch August 8, 2024 22:15
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.

2 participants