use of com.couchbase.client.java.query.ReactiveQueryResult in project couchbase-jvm-clients by couchbase.
the class QueryIntegrationTest method reactivePositionalParameterizedSelectQuery.
@Test
void reactivePositionalParameterizedSelectQuery() {
String id = insertDoc();
QueryOptions options = queryOptions().scanConsistency(QueryScanConsistency.REQUEST_PLUS).parameters(JsonArray.from(id));
Mono<ReactiveQueryResult> result = cluster.reactive().query("select * from " + bucketName + " where meta().id=$1", options);
List<JsonObject> rows = result.flux().flatMap(ReactiveQueryResult::rowsAsObject).collectList().block();
assertNotNull(rows);
assertEquals(1, rows.size());
}
use of com.couchbase.client.java.query.ReactiveQueryResult in project couchbase-jvm-clients by couchbase.
the class QueryIntegrationTest method reactiveSelect.
@Test
void reactiveSelect() {
String id = insertDoc();
QueryOptions options = queryOptions().scanConsistency(QueryScanConsistency.REQUEST_PLUS);
Mono<ReactiveQueryResult> result = cluster.reactive().query("select * from " + bucketName + " where meta().id=\"" + id + "\"", options);
List<JsonObject> rows = result.flux().flatMap(ReactiveQueryResult::rowsAsObject).collectList().block();
assertNotNull(rows);
assertEquals(1, rows.size());
}
use of com.couchbase.client.java.query.ReactiveQueryResult in project couchbase-jvm-clients by couchbase.
the class QueryCollectionIntegrationTest method performsAdhocQuery.
@Test
void performsAdhocQuery() {
Scope scope = cluster.bucket(config().bucketname()).scope(SCOPE_NAME);
Collection collection = scope.collection(COLLECTION_NAME);
String id = insertDoc(collection);
QueryOptions options = queryOptions().scanConsistency(QueryScanConsistency.REQUEST_PLUS);
QueryResult result = scope.query("select * from `" + COLLECTION_NAME + "` where meta().id=\"" + id + "\"", options);
assertEquals(QueryStatus.SUCCESS, result.metaData().status());
assertEquals(1, result.rowsAsObject().size());
ReactiveScope reactiveScope = cluster.bucket(config().bucketname()).reactive().scope(SCOPE_NAME);
ReactiveQueryResult reactiveResult = reactiveScope.query("select * from `" + COLLECTION_NAME + "` where meta().id=\"" + id + "\"", options).block();
assertEquals(QueryStatus.SUCCESS, reactiveResult.metaData().block().status());
assertEquals(1, reactiveResult.rowsAsObject().blockLast().size());
}
use of com.couchbase.client.java.query.ReactiveQueryResult in project couchbase-jvm-clients by couchbase.
the class QueryIntegrationTest method reactiveNamedParameterizedSelectQuery.
@Test
void reactiveNamedParameterizedSelectQuery() {
String id = insertDoc();
QueryOptions options = queryOptions().scanConsistency(QueryScanConsistency.REQUEST_PLUS).parameters(JsonObject.create().put("id", id));
Mono<ReactiveQueryResult> result = cluster.reactive().query("select * from " + bucketName + " where meta().id=$id", options);
List<JsonObject> rows = result.flux().flatMap(ReactiveQueryResult::rowsAsObject).collectList().block();
assertNotNull(rows);
assertEquals(1, rows.size());
}
Aggregations