DATAMONGO-2507 - Add default method matching(CriteriaDefinition) to ReactiveFindOperation.DistinctWithQuery.
Original Pull Request: #852
This commit is contained in:
committed by
Christoph Strobl
parent
bf921cdbd7
commit
c6630aa279
@@ -46,6 +46,7 @@ import org.springframework.data.mongodb.core.query.Query;
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @author Christoph Strobl
|
||||
* @author Juergen Zimmermann
|
||||
* @since 2.0
|
||||
*/
|
||||
public interface ReactiveFindOperation {
|
||||
@@ -275,6 +276,18 @@ public interface ReactiveFindOperation {
|
||||
* @throws IllegalArgumentException if resultType is {@literal null}.
|
||||
*/
|
||||
TerminatingDistinct<T> matching(Query query);
|
||||
|
||||
/**
|
||||
* Set the filter {@link CriteriaDefinition criteria} to be used.
|
||||
*
|
||||
* @param criteriaDefinition must not be {@literal null}.
|
||||
* @return new instance of {@link TerminatingFind}.
|
||||
* @throws IllegalArgumentException if query is {@literal null}.
|
||||
* @since 3.0
|
||||
*/
|
||||
default TerminatingDistinct<T> matching(CriteriaDefinition criteriaDefinition) {
|
||||
return matching(Query.query(criteriaDefinition));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,6 +59,7 @@ import com.mongodb.client.MongoClient;
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @author Christoph Strobl
|
||||
* @author Juergen Zimmermann
|
||||
*/
|
||||
@ExtendWith(MongoClientExtension.class)
|
||||
class ReactiveFindOperationSupportTests {
|
||||
@@ -171,6 +172,14 @@ class ReactiveFindOperationSupportTests {
|
||||
.verifyComplete();
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-2507
|
||||
void findAllWithProjectionByCriteria() {
|
||||
|
||||
template.query(Person.class).as(Jedi.class).matching(where("firstname").is("luke")).all()
|
||||
.as(StepVerifier::create).consumeNextWith(it -> assertThat(it).isInstanceOf(Jedi.class)) //
|
||||
.verifyComplete();
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1719
|
||||
void findAllByWithCollectionUsingMappingInformation() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user