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

Support options arg for distinct(): Model.distinct() doesn't have { session } #8006

Closed
exentrich opened this issue Jul 22, 2019 · 3 comments
Closed
Labels
enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Milestone

Comments

@exentrich
Copy link

Unlike other methods distinct() doesn't have { session } option.
How to workaround it?

@Fonger
Copy link
Contributor

Fonger commented Jul 23, 2019

You can use it this way

Model.distinct(...).setOptions({ session: exampleSession })

The reason why distinct() doesn't support options parameter is that we can't distinguish the input object is for conditions or options since both of them are optional.

@exentrich
Copy link
Author

Thank you for clarification!

@amitbeck
Copy link
Contributor

amitbeck commented Jul 2, 2024

The reason why distinct() doesn't support options parameter is that we can't distinguish the input object is for conditions or options since both of them are optional.

Thanks for the clarification. I think that discouraging using the session option completely and encouraging using the {Query | Aggregate}.prototype.session() function would be the best option.

Currently some Model static methods such as bulkWrite() and create() aren't usable with session() because they return a Promise, causing inconsistency.

@vkarpov15 vkarpov15 reopened this Jul 6, 2024
@vkarpov15 vkarpov15 changed the title Model.distinct() doesn't have { session } Support options arg for distinct(): Model.distinct() doesn't have { session } Jul 6, 2024
@vkarpov15 vkarpov15 added this to the 8.6 milestone Jul 6, 2024
@vkarpov15 vkarpov15 added the enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature label Jul 6, 2024
vkarpov15 added a commit that referenced this issue Aug 8, 2024
feat(model+query): support `options` parameter for distinct()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Projects
None yet
Development

No branches or pull requests

4 participants