diff --git a/pom.xml b/pom.xml
index f6a6789f3..5e1661471 100644
--- a/pom.xml
+++ b/pom.xml
@@ -85,6 +85,13 @@
test
+
+ io.projectreactor
+ reactor-test
+ 3.1.0.RELEASE
+ test
+
+
com.fasterxml.jackson.core
jackson-databind
diff --git a/src/main/java/org/springframework/data/couchbase/core/ExecutableExistsByIdOperationSupport.java b/src/main/java/org/springframework/data/couchbase/core/ExecutableExistsByIdOperationSupport.java
index b8a63a9ec..3841fa647 100644
--- a/src/main/java/org/springframework/data/couchbase/core/ExecutableExistsByIdOperationSupport.java
+++ b/src/main/java/org/springframework/data/couchbase/core/ExecutableExistsByIdOperationSupport.java
@@ -15,6 +15,8 @@
*/
package org.springframework.data.couchbase.core;
+import org.springframework.data.couchbase.core.ReactiveExistsByIdOperationSupport.ReactiveExistsByIdSupport;
+
import java.util.Collection;
import java.util.Map;
@@ -36,12 +38,11 @@ public ExecutableExistsById existsById() {
static class ExecutableExistsByIdSupport implements ExecutableExistsById {
private final CouchbaseTemplate template;
- private final ReactiveExistsByIdOperationSupport.ReactiveExistsByIdSupport reactiveSupport;
+ private final ReactiveExistsByIdSupport reactiveSupport;
ExecutableExistsByIdSupport(final CouchbaseTemplate template, final String collection) {
this.template = template;
- this.reactiveSupport = new ReactiveExistsByIdOperationSupport.ReactiveExistsByIdSupport(template.reactive(),
- collection);
+ this.reactiveSupport = new ReactiveExistsByIdSupport(template.reactive(), collection);
}
@Override
diff --git a/src/main/java/org/springframework/data/couchbase/core/ExecutableFindByAnalyticsOperationSupport.java b/src/main/java/org/springframework/data/couchbase/core/ExecutableFindByAnalyticsOperationSupport.java
index 0be1cb59b..2a3568a7c 100644
--- a/src/main/java/org/springframework/data/couchbase/core/ExecutableFindByAnalyticsOperationSupport.java
+++ b/src/main/java/org/springframework/data/couchbase/core/ExecutableFindByAnalyticsOperationSupport.java
@@ -15,13 +15,14 @@
*/
package org.springframework.data.couchbase.core;
+import org.springframework.data.couchbase.core.ReactiveFindByAnalyticsOperationSupport.ReactiveFindByAnalyticsSupport;
+
import java.util.List;
import java.util.stream.Stream;
-import com.couchbase.client.java.analytics.AnalyticsScanConsistency;
-import com.couchbase.client.java.query.QueryScanConsistency;
import org.springframework.data.couchbase.core.query.AnalyticsQuery;
-import org.springframework.data.couchbase.core.query.Query;
+
+import com.couchbase.client.java.analytics.AnalyticsScanConsistency;
public class ExecutableFindByAnalyticsOperationSupport implements ExecutableFindByAnalyticsOperation {
@@ -35,14 +36,15 @@ public ExecutableFindByAnalyticsOperationSupport(final CouchbaseTemplate templat
@Override
public ExecutableFindByAnalytics findByAnalytics(final Class domainType) {
- return new ExecutableFindByAnalyticsSupport<>(template, domainType, ALL_QUERY, AnalyticsScanConsistency.NOT_BOUNDED);
+ return new ExecutableFindByAnalyticsSupport<>(template, domainType, ALL_QUERY,
+ AnalyticsScanConsistency.NOT_BOUNDED);
}
static class ExecutableFindByAnalyticsSupport implements ExecutableFindByAnalytics {
private final CouchbaseTemplate template;
private final Class domainType;
- private final ReactiveFindByAnalyticsOperationSupport.ReactiveFindByAnalyticsSupport reactiveSupport;
+ private final ReactiveFindByAnalyticsSupport reactiveSupport;
private final AnalyticsQuery query;
private final AnalyticsScanConsistency scanConsistency;
@@ -51,8 +53,8 @@ static class ExecutableFindByAnalyticsSupport implements ExecutableFindByAnal
this.template = template;
this.domainType = domainType;
this.query = query;
- this.reactiveSupport = new ReactiveFindByAnalyticsOperationSupport.ReactiveFindByAnalyticsSupport<>(
- template.reactive(), domainType, query, scanConsistency);
+ this.reactiveSupport = new ReactiveFindByAnalyticsSupport<>(template.reactive(), domainType, query,
+ scanConsistency);
this.scanConsistency = scanConsistency;
}
diff --git a/src/main/java/org/springframework/data/couchbase/core/ExecutableFindByIdOperationSupport.java b/src/main/java/org/springframework/data/couchbase/core/ExecutableFindByIdOperationSupport.java
index ad4a333b2..8f8ca26a6 100644
--- a/src/main/java/org/springframework/data/couchbase/core/ExecutableFindByIdOperationSupport.java
+++ b/src/main/java/org/springframework/data/couchbase/core/ExecutableFindByIdOperationSupport.java
@@ -15,6 +15,8 @@
*/
package org.springframework.data.couchbase.core;
+import org.springframework.data.couchbase.core.ReactiveFindByIdOperationSupport.ReactiveFindByIdSupport;
+
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@@ -40,15 +42,14 @@ static class ExecutableFindByIdSupport implements ExecutableFindById {
private final Class domainType;
private final String collection;
private final List fields;
- private final ReactiveFindByIdOperationSupport.ReactiveFindByIdSupport reactiveSupport;
+ private final ReactiveFindByIdSupport reactiveSupport;
ExecutableFindByIdSupport(CouchbaseTemplate template, Class domainType, String collection, List fields) {
this.template = template;
this.domainType = domainType;
this.collection = collection;
this.fields = fields;
- this.reactiveSupport = new ReactiveFindByIdOperationSupport.ReactiveFindByIdSupport<>(template.reactive(),
- domainType, collection, fields);
+ this.reactiveSupport = new ReactiveFindByIdSupport<>(template.reactive(), domainType, collection, fields);
}
@Override
diff --git a/src/main/java/org/springframework/data/couchbase/core/ExecutableFindByQueryOperation.java b/src/main/java/org/springframework/data/couchbase/core/ExecutableFindByQueryOperation.java
index 5078d7019..883b6e91f 100644
--- a/src/main/java/org/springframework/data/couchbase/core/ExecutableFindByQueryOperation.java
+++ b/src/main/java/org/springframework/data/couchbase/core/ExecutableFindByQueryOperation.java
@@ -130,6 +130,17 @@ interface FindByQueryConsistentWith extends FindByQueryWithQuery {
}
- interface ExecutableFindByQuery extends FindByQueryConsistentWith {}
+ interface FindByQueryInCollection extends FindByQueryConsistentWith {
+
+ /**
+ * Allows to override the default scan consistency.
+ *
+ * @param collection the collection to use for this query.
+ */
+ FindByQueryInCollection inCollection(String collection);
+
+ }
+
+ interface ExecutableFindByQuery extends FindByQueryInCollection {}
}
diff --git a/src/main/java/org/springframework/data/couchbase/core/ExecutableFindByQueryOperationSupport.java b/src/main/java/org/springframework/data/couchbase/core/ExecutableFindByQueryOperationSupport.java
index 7f569501b..a5c4838c1 100644
--- a/src/main/java/org/springframework/data/couchbase/core/ExecutableFindByQueryOperationSupport.java
+++ b/src/main/java/org/springframework/data/couchbase/core/ExecutableFindByQueryOperationSupport.java
@@ -18,11 +18,17 @@
import java.util.List;
import java.util.stream.Stream;
+import org.springframework.data.couchbase.core.ReactiveFindByQueryOperationSupport.ReactiveFindByQuerySupport;
import org.springframework.data.couchbase.core.query.Query;
import com.couchbase.client.java.query.QueryScanConsistency;
-import org.springframework.data.couchbase.core.ReactiveFindByQueryOperationSupport.ReactiveFindByQuerySupport;
+/**
+ * {@link ExecutableFindByQueryOperation} implementations for Couchbase.
+ *
+ * @author Michael Nitschinger
+ * @author Michael Reiche
+ */
public class ExecutableFindByQueryOperationSupport implements ExecutableFindByQueryOperation {
private static final Query ALL_QUERY = new Query();
@@ -35,7 +41,8 @@ public ExecutableFindByQueryOperationSupport(final CouchbaseTemplate template) {
@Override
public ExecutableFindByQuery findByQuery(final Class domainType) {
- return new ExecutableFindByQuerySupport<>(template, domainType, ALL_QUERY, QueryScanConsistency.NOT_BOUNDED);
+ return new ExecutableFindByQuerySupport<>(template, domainType, ALL_QUERY, QueryScanConsistency.NOT_BOUNDED,
+ "_default._default");
}
static class ExecutableFindByQuerySupport implements ExecutableFindByQuery {
@@ -43,16 +50,19 @@ static class ExecutableFindByQuerySupport implements ExecutableFindByQuery
private final CouchbaseTemplate template;
private final Class domainType;
private final Query query;
- private final ReactiveFindByQueryOperationSupport.ReactiveFindByQuerySupport reactiveSupport;
+ private final ReactiveFindByQuerySupport reactiveSupport;
private final QueryScanConsistency scanConsistency;
+ private final String collection;
ExecutableFindByQuerySupport(final CouchbaseTemplate template, final Class domainType, final Query query,
- final QueryScanConsistency scanConsistency) {
+ final QueryScanConsistency scanConsistency, final String collection) {
this.template = template;
this.domainType = domainType;
this.query = query;
- this.reactiveSupport = new ReactiveFindByQuerySupport(template.reactive(), domainType, query, scanConsistency);
+ this.reactiveSupport = new ReactiveFindByQuerySupport(template.reactive(), domainType, query, scanConsistency,
+ collection);
this.scanConsistency = scanConsistency;
+ this.collection = collection;
}
@Override
@@ -78,12 +88,17 @@ public TerminatingFindByQuery matching(final Query query) {
} else {
scanCons = scanConsistency;
}
- return new ExecutableFindByQuerySupport<>(template, domainType, query, scanCons);
+ return new ExecutableFindByQuerySupport<>(template, domainType, query, scanCons, collection);
}
@Override
public FindByQueryConsistentWith consistentWith(final QueryScanConsistency scanConsistency) {
- return new ExecutableFindByQuerySupport<>(template, domainType, query, scanConsistency);
+ return new ExecutableFindByQuerySupport<>(template, domainType, query, scanConsistency, collection);
+ }
+
+ @Override
+ public FindByQueryInCollection inCollection(final String collection) {
+ return new ExecutableFindByQuerySupport<>(template, domainType, query, scanConsistency, collection);
}
@Override
diff --git a/src/main/java/org/springframework/data/couchbase/core/ExecutableFindFromReplicasByIdOperationSupport.java b/src/main/java/org/springframework/data/couchbase/core/ExecutableFindFromReplicasByIdOperationSupport.java
index 54e7f2c87..beefe1046 100644
--- a/src/main/java/org/springframework/data/couchbase/core/ExecutableFindFromReplicasByIdOperationSupport.java
+++ b/src/main/java/org/springframework/data/couchbase/core/ExecutableFindFromReplicasByIdOperationSupport.java
@@ -17,6 +17,7 @@
import java.util.Collection;
+import org.springframework.data.couchbase.core.ReactiveFindFromReplicasByIdOperationSupport.ReactiveFindFromReplicasByIdSupport;
import org.springframework.util.Assert;
public class ExecutableFindFromReplicasByIdOperationSupport implements ExecutableFindFromReplicasByIdOperation {
@@ -37,14 +38,13 @@ static class ExecutableFindFromReplicasByIdSupport implements ExecutableFindF
private final CouchbaseTemplate template;
private final Class domainType;
private final String collection;
- private final ReactiveFindFromReplicasByIdOperationSupport.ReactiveFindFromReplicasByIdSupport reactiveSupport;
+ private final ReactiveFindFromReplicasByIdSupport reactiveSupport;
ExecutableFindFromReplicasByIdSupport(CouchbaseTemplate template, Class domainType, String collection) {
this.template = template;
this.domainType = domainType;
this.collection = collection;
- this.reactiveSupport = new ReactiveFindFromReplicasByIdOperationSupport.ReactiveFindFromReplicasByIdSupport<>(
- template.reactive(), domainType, collection);
+ this.reactiveSupport = new ReactiveFindFromReplicasByIdSupport<>(template.reactive(), domainType, collection);
}
@Override
diff --git a/src/main/java/org/springframework/data/couchbase/core/ExecutableInsertByIdOperationSupport.java b/src/main/java/org/springframework/data/couchbase/core/ExecutableInsertByIdOperationSupport.java
index 18fa5b382..7405fad64 100644
--- a/src/main/java/org/springframework/data/couchbase/core/ExecutableInsertByIdOperationSupport.java
+++ b/src/main/java/org/springframework/data/couchbase/core/ExecutableInsertByIdOperationSupport.java
@@ -18,6 +18,7 @@
import java.time.Duration;
import java.util.Collection;
+import org.springframework.data.couchbase.core.ReactiveInsertByIdOperationSupport.ReactiveInsertByIdSupport;
import org.springframework.util.Assert;
import com.couchbase.client.core.msg.kv.DurabilityLevel;
@@ -48,7 +49,7 @@ static class ExecutableInsertByIdSupport implements ExecutableInsertById {
private final ReplicateTo replicateTo;
private final DurabilityLevel durabilityLevel;
private final Duration expiry;
- private final ReactiveInsertByIdOperationSupport.ReactiveInsertByIdSupport reactiveSupport;
+ private final ReactiveInsertByIdSupport reactiveSupport;
ExecutableInsertByIdSupport(final CouchbaseTemplate template, final Class domainType, final String collection,
final PersistTo persistTo, final ReplicateTo replicateTo, final DurabilityLevel durabilityLevel,
@@ -60,8 +61,8 @@ static class ExecutableInsertByIdSupport implements ExecutableInsertById {
this.replicateTo = replicateTo;
this.durabilityLevel = durabilityLevel;
this.expiry = expiry;
- this.reactiveSupport = new ReactiveInsertByIdOperationSupport.ReactiveInsertByIdSupport<>(template.reactive(),
- domainType, collection, persistTo, replicateTo, durabilityLevel, expiry);
+ this.reactiveSupport = new ReactiveInsertByIdSupport<>(template.reactive(), domainType, collection, persistTo,
+ replicateTo, durabilityLevel, expiry);
}
@Override
diff --git a/src/main/java/org/springframework/data/couchbase/core/ExecutableRemoveByIdOperationSupport.java b/src/main/java/org/springframework/data/couchbase/core/ExecutableRemoveByIdOperationSupport.java
index 27fed458c..3d1f10778 100644
--- a/src/main/java/org/springframework/data/couchbase/core/ExecutableRemoveByIdOperationSupport.java
+++ b/src/main/java/org/springframework/data/couchbase/core/ExecutableRemoveByIdOperationSupport.java
@@ -18,6 +18,7 @@
import java.util.Collection;
import java.util.List;
+import org.springframework.data.couchbase.core.ReactiveRemoveByIdOperationSupport.ReactiveRemoveByIdSupport;
import org.springframework.util.Assert;
import com.couchbase.client.core.msg.kv.DurabilityLevel;
@@ -44,7 +45,7 @@ static class ExecutableRemoveByIdSupport implements ExecutableRemoveById {
private final PersistTo persistTo;
private final ReplicateTo replicateTo;
private final DurabilityLevel durabilityLevel;
- private final ReactiveRemoveByIdOperationSupport.ReactiveRemoveByIdSupport reactiveRemoveByIdSupport;
+ private final ReactiveRemoveByIdSupport reactiveRemoveByIdSupport;
ExecutableRemoveByIdSupport(final CouchbaseTemplate template, final String collection, final PersistTo persistTo,
final ReplicateTo replicateTo, final DurabilityLevel durabilityLevel) {
@@ -53,8 +54,8 @@ static class ExecutableRemoveByIdSupport implements ExecutableRemoveById {
this.persistTo = persistTo;
this.replicateTo = replicateTo;
this.durabilityLevel = durabilityLevel;
- this.reactiveRemoveByIdSupport = new ReactiveRemoveByIdOperationSupport.ReactiveRemoveByIdSupport(
- template.reactive(), collection, persistTo, replicateTo, durabilityLevel);
+ this.reactiveRemoveByIdSupport = new ReactiveRemoveByIdSupport(template.reactive(), collection, persistTo,
+ replicateTo, durabilityLevel);
}
@Override
diff --git a/src/main/java/org/springframework/data/couchbase/core/ExecutableRemoveByQueryOperation.java b/src/main/java/org/springframework/data/couchbase/core/ExecutableRemoveByQueryOperation.java
index 397535e22..9b50fdedb 100644
--- a/src/main/java/org/springframework/data/couchbase/core/ExecutableRemoveByQueryOperation.java
+++ b/src/main/java/org/springframework/data/couchbase/core/ExecutableRemoveByQueryOperation.java
@@ -43,6 +43,12 @@ interface RemoveByQueryConsistentWith extends RemoveByQueryWithQuery {
}
- interface ExecutableRemoveByQuery extends RemoveByQueryConsistentWith {}
+ interface RemoveByQueryInCollection extends RemoveByQueryConsistentWith {
+
+ RemoveByQueryConsistentWith inCollection(String collection);
+
+ }
+
+ interface ExecutableRemoveByQuery extends RemoveByQueryInCollection {}
}
diff --git a/src/main/java/org/springframework/data/couchbase/core/ExecutableRemoveByQueryOperationSupport.java b/src/main/java/org/springframework/data/couchbase/core/ExecutableRemoveByQueryOperationSupport.java
index f1c4eced5..32e98a98a 100644
--- a/src/main/java/org/springframework/data/couchbase/core/ExecutableRemoveByQueryOperationSupport.java
+++ b/src/main/java/org/springframework/data/couchbase/core/ExecutableRemoveByQueryOperationSupport.java
@@ -17,6 +17,7 @@
import java.util.List;
+import org.springframework.data.couchbase.core.ReactiveRemoveByQueryOperationSupport.ReactiveRemoveByQuerySupport;
import org.springframework.data.couchbase.core.query.Query;
import com.couchbase.client.java.query.QueryScanConsistency;
@@ -33,7 +34,8 @@ public ExecutableRemoveByQueryOperationSupport(final CouchbaseTemplate template)
@Override
public ExecutableRemoveByQuery removeByQuery(Class domainType) {
- return new ExecutableRemoveByQuerySupport<>(template, domainType, ALL_QUERY, QueryScanConsistency.NOT_BOUNDED);
+ return new ExecutableRemoveByQuerySupport<>(template, domainType, ALL_QUERY, QueryScanConsistency.NOT_BOUNDED,
+ "_default._default");
}
static class ExecutableRemoveByQuerySupport implements ExecutableRemoveByQuery {
@@ -41,17 +43,19 @@ static class ExecutableRemoveByQuerySupport implements ExecutableRemoveByQuer
private final CouchbaseTemplate template;
private final Class domainType;
private final Query query;
- private final ReactiveRemoveByQueryOperationSupport.ReactiveRemoveByQuerySupport reactiveSupport;
+ private final ReactiveRemoveByQuerySupport reactiveSupport;
private final QueryScanConsistency scanConsistency;
+ private final String collection;
ExecutableRemoveByQuerySupport(final CouchbaseTemplate template, final Class domainType, final Query query,
- final QueryScanConsistency scanConsistency) {
+ final QueryScanConsistency scanConsistency, String collection) {
this.template = template;
this.domainType = domainType;
this.query = query;
- this.reactiveSupport = new ReactiveRemoveByQueryOperationSupport.ReactiveRemoveByQuerySupport<>(
- template.reactive(), domainType, query, scanConsistency);
+ this.reactiveSupport = new ReactiveRemoveByQuerySupport<>(template.reactive(), domainType, query, scanConsistency,
+ collection);
this.scanConsistency = scanConsistency;
+ this.collection = collection;
}
@Override
@@ -61,12 +65,17 @@ public List all() {
@Override
public TerminatingRemoveByQuery matching(final Query query) {
- return new ExecutableRemoveByQuerySupport<>(template, domainType, query, scanConsistency);
+ return new ExecutableRemoveByQuerySupport<>(template, domainType, query, scanConsistency, collection);
}
@Override
public RemoveByQueryWithQuery consistentWith(final QueryScanConsistency scanConsistency) {
- return new ExecutableRemoveByQuerySupport<>(template, domainType, query, scanConsistency);
+ return new ExecutableRemoveByQuerySupport<>(template, domainType, query, scanConsistency, collection);
+ }
+
+ @Override
+ public RemoveByQueryInCollection inCollection(final String collection) {
+ return new ExecutableRemoveByQuerySupport<>(template, domainType, query, scanConsistency, collection);
}
}
diff --git a/src/main/java/org/springframework/data/couchbase/core/ExecutableReplaceByIdOperationSupport.java b/src/main/java/org/springframework/data/couchbase/core/ExecutableReplaceByIdOperationSupport.java
index 888c998f4..399fa6969 100644
--- a/src/main/java/org/springframework/data/couchbase/core/ExecutableReplaceByIdOperationSupport.java
+++ b/src/main/java/org/springframework/data/couchbase/core/ExecutableReplaceByIdOperationSupport.java
@@ -19,6 +19,7 @@
import java.util.Collection;
import org.springframework.util.Assert;
+import org.springframework.data.couchbase.core.ReactiveReplaceByIdOperationSupport.ReactiveReplaceByIdSupport;
import com.couchbase.client.core.msg.kv.DurabilityLevel;
import com.couchbase.client.java.kv.PersistTo;
@@ -48,7 +49,7 @@ static class ExecutableReplaceByIdSupport implements ExecutableReplaceById
private final ReplicateTo replicateTo;
private final DurabilityLevel durabilityLevel;
private final Duration expiry;
- private final ReactiveReplaceByIdOperationSupport.ReactiveReplaceByIdSupport reactiveSupport;
+ private final ReactiveReplaceByIdSupport reactiveSupport;
ExecutableReplaceByIdSupport(final CouchbaseTemplate template, final Class domainType, final String collection,
final PersistTo persistTo, final ReplicateTo replicateTo, final DurabilityLevel durabilityLevel,
@@ -60,7 +61,7 @@ static class ExecutableReplaceByIdSupport implements ExecutableReplaceById
this.replicateTo = replicateTo;
this.durabilityLevel = durabilityLevel;
this.expiry = expiry;
- this.reactiveSupport = new ReactiveReplaceByIdOperationSupport.ReactiveReplaceByIdSupport<>(template.reactive(),
+ this.reactiveSupport = new ReactiveReplaceByIdSupport<>(template.reactive(),
domainType, collection, persistTo, replicateTo, durabilityLevel, expiry);
}
diff --git a/src/main/java/org/springframework/data/couchbase/core/ExecutableUpsertByIdOperationSupport.java b/src/main/java/org/springframework/data/couchbase/core/ExecutableUpsertByIdOperationSupport.java
index 3c4c70c67..9ec260ce8 100644
--- a/src/main/java/org/springframework/data/couchbase/core/ExecutableUpsertByIdOperationSupport.java
+++ b/src/main/java/org/springframework/data/couchbase/core/ExecutableUpsertByIdOperationSupport.java
@@ -19,6 +19,7 @@
import java.util.Collection;
import org.springframework.util.Assert;
+import org.springframework.data.couchbase.core.ReactiveUpsertByIdOperationSupport.ReactiveUpsertByIdSupport;
import com.couchbase.client.core.msg.kv.DurabilityLevel;
import com.couchbase.client.java.kv.PersistTo;
@@ -48,7 +49,7 @@ static class ExecutableUpsertByIdSupport implements ExecutableUpsertById {
private final ReplicateTo replicateTo;
private final DurabilityLevel durabilityLevel;
private final Duration expiry;
- private final ReactiveUpsertByIdOperationSupport.ReactiveUpsertByIdSupport reactiveSupport;
+ private final ReactiveUpsertByIdSupport reactiveSupport;
ExecutableUpsertByIdSupport(final CouchbaseTemplate template, final Class domainType, final String collection,
final PersistTo persistTo, final ReplicateTo replicateTo, final DurabilityLevel durabilityLevel,
@@ -60,7 +61,7 @@ static class ExecutableUpsertByIdSupport implements ExecutableUpsertById {
this.replicateTo = replicateTo;
this.durabilityLevel = durabilityLevel;
this.expiry = expiry;
- this.reactiveSupport = new ReactiveUpsertByIdOperationSupport.ReactiveUpsertByIdSupport<>(template.reactive(),
+ this.reactiveSupport = new ReactiveUpsertByIdSupport<>(template.reactive(),
domainType, collection, persistTo, replicateTo, durabilityLevel, expiry);
}
diff --git a/src/main/java/org/springframework/data/couchbase/core/ReactiveFindByAnalyticsOperationSupport.java b/src/main/java/org/springframework/data/couchbase/core/ReactiveFindByAnalyticsOperationSupport.java
index 598048ba5..73de94c30 100644
--- a/src/main/java/org/springframework/data/couchbase/core/ReactiveFindByAnalyticsOperationSupport.java
+++ b/src/main/java/org/springframework/data/couchbase/core/ReactiveFindByAnalyticsOperationSupport.java
@@ -17,7 +17,6 @@
import com.couchbase.client.java.analytics.AnalyticsOptions;
import com.couchbase.client.java.analytics.AnalyticsScanConsistency;
-import com.couchbase.client.java.query.QueryOptions;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
diff --git a/src/main/java/org/springframework/data/couchbase/core/ReactiveFindByQueryOperation.java b/src/main/java/org/springframework/data/couchbase/core/ReactiveFindByQueryOperation.java
index 309431f9c..1b99af3c7 100644
--- a/src/main/java/org/springframework/data/couchbase/core/ReactiveFindByQueryOperation.java
+++ b/src/main/java/org/springframework/data/couchbase/core/ReactiveFindByQueryOperation.java
@@ -15,14 +15,20 @@
*/
package org.springframework.data.couchbase.core;
-import org.springframework.dao.IncorrectResultSizeDataAccessException;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
+import org.springframework.dao.IncorrectResultSizeDataAccessException;
import org.springframework.data.couchbase.core.query.Query;
import com.couchbase.client.java.query.QueryScanConsistency;
+/**
+ * ReactiveFindByQueryOperation
+ *
+ * @author Michael Nitschinger
+ * @author Michael Reiche
+ */
public interface ReactiveFindByQueryOperation {
/**
@@ -104,6 +110,129 @@ interface FindByQueryConsistentWith extends FindByQueryWithQuery {
}
- interface ReactiveFindByQuery extends FindByQueryConsistentWith {}
+ /**
+ * Collection override (optional).
+ */
+ interface FindByQueryInCollection extends FindByQueryWithQuery {
+
+ /**
+ * Explicitly set the name of the collection to perform the query on.
+ * Skip this step to use the default collection derived from the domain type.
+ *
+ * @param collection must not be {@literal null} nor {@literal empty}.
+ * @return new instance of {@link FindWithProjection}.
+ * @throws IllegalArgumentException if collection is {@literal null}.
+ */
+ FindByQueryInCollection inCollection(String collection);
+ }
+
+ /**
+ * Result type override (optional).
+ */
+ interface FindWithProjection extends FindByQueryInCollection, FindDistinct {
+
+ /**
+ * Define the target type fields should be mapped to.
+ * Skip this step if you are anyway only interested in the original domain type.
+ *
+ * @param resultType must not be {@literal null}.
+ * @param result type.
+ * @return new instance of {@link FindWithProjection}.
+ * @throws IllegalArgumentException if resultType is {@literal null}.
+ */
+ FindByQueryWithQuery as(Class resultType);
+ }
+
+ /**
+ * Distinct Find support.
+ *
+ * @author Christoph Strobl
+ * @since 2.1
+ */
+ interface FindDistinct {
+
+ /**
+ * Finds the distinct values for a specified {@literal field} across a single {@link } or view.
+ *
+ * @param field name of the field. Must not be {@literal null}.
+ * @return new instance of {@link TerminatingDistinct}.
+ * @throws IllegalArgumentException if field is {@literal null}.
+ */
+ TerminatingDistinct