-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
type: enhancementA general enhancementA general enhancement
Description
Mark Paluch opened DATAMONGO-1985 and commented
It would be great to support distinct queries using closed projections and repository query methods. Given a closed projection selecting a single field (or string queries projecting a single field) we should be able to construct distinct queries.
public interface FooBarRepository extends ReactiveCrudRepository<FooBar, String> {
Flux<IdentifierOnly> findDistinctByFooAndBar(String foo, String bar);
}The document / collection class:
@Document
public class FooBar {
private String identifier; // not unique
private String foo;
private String bar;
// extra fields
// getters and setters
}The closed projection:
public interface IdentifierOnly {
getIdentifier();
}
Reference URL: https://stackoverflow.com/questions/50473631/spring-data-mongodb-reactive-distinct-not-working
shollander
Metadata
Metadata
Assignees
Labels
type: enhancementA general enhancementA general enhancement