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

Typesafe Extension Function for ReactiveFindOperation.FindDistinct [DATAMONGO-2417] #3239

spring-projects-issues opened this issue Nov 13, 2019 · 2 comments


Copy link

@spring-projects-issues spring-projects-issues commented Nov 13, 2019

Juergen Zimmermann opened DATAMONGO-2417 and commented

IMHO it would be nice to invoke the distinct() function in a typesafe manner, e.g.
mongo.query<Customer>().distinct(Customer::name) instead of mongo.query<Customer>().distinct("name").

The extension might look like the following:
fun distinct(key: KProperty<*>): TerminatingDistinct<Any> =   ReactiveFindOperation.FindDistinct.distinct(asString(key))

Affects: 2.2.1 (Moore SR1)

Referenced from: pull request #809

Copy link

@spring-projects-issues spring-projects-issues commented Nov 22, 2019

Mark Paluch commented

Thanks for this suggestion. It makes sense to add a KProperty extension here. We could also consider a shortcut as mongo.distinct(Customer::name) for simple cases to infer the domain type along with the field name.

Copy link

@spring-projects-issues spring-projects-issues commented Jan 15, 2020

Juergen Zimmermann commented

Christoph Strobl Is there a chance that #809 will be merged in Spring Data MongoDB 2.2.5.RELEASE since 2.2.4.RELEASE is already released?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants