Search in sources :

Example 1 with LookupInOptions

use of com.couchbase.client.java.kv.LookupInOptions in project couchbase-jvm-clients by couchbase.

the class ReactiveCollection method lookupIn.

/**
 * Performs lookups to document fragments with custom options.
 *
 * @param id the outer document ID.
 * @param specs the spec which specifies the type of lookups to perform.
 * @param options custom options to modify the lookup options.
 * @return the {@link LookupInResult} once the lookup has been performed or failed.
 */
public Mono<LookupInResult> lookupIn(final String id, List<LookupInSpec> specs, final LookupInOptions options) {
    return Mono.defer(() -> {
        notNull(options, "LookupInOptions", () -> ReducedKeyValueErrorContext.create(id, asyncCollection.collectionIdentifier()));
        LookupInOptions.Built opts = options.build();
        JsonSerializer serializer = opts.serializer() == null ? environment().jsonSerializer() : opts.serializer();
        SubdocGetRequest request = asyncCollection.lookupInRequest(id, specs, opts);
        return Reactor.wrap(request, LookupInAccessor.lookupInAccessor(core, request, serializer), true);
    });
}
Also used : LookupInOptions(com.couchbase.client.java.kv.LookupInOptions) JsonSerializer(com.couchbase.client.java.codec.JsonSerializer) SubdocGetRequest(com.couchbase.client.core.msg.kv.SubdocGetRequest)

Example 2 with LookupInOptions

use of com.couchbase.client.java.kv.LookupInOptions in project couchbase-jvm-clients by couchbase.

the class AsyncCollection method lookupIn.

/**
 * Performs lookups to document fragments with custom options.
 *
 * @param id the outer document ID.
 * @param specs the spec which specifies the type of lookups to perform.
 * @param options custom options to modify the lookup options.
 * @return the {@link LookupInResult} once the lookup has been performed or failed.
 */
public CompletableFuture<LookupInResult> lookupIn(final String id, final List<LookupInSpec> specs, final LookupInOptions options) {
    notNull(options, "LookupInOptions", () -> ReducedKeyValueErrorContext.create(id, collectionIdentifier));
    LookupInOptions.Built opts = options.build();
    final JsonSerializer serializer = opts.serializer() == null ? environment.jsonSerializer() : opts.serializer();
    return LookupInAccessor.lookupInAccessor(core, lookupInRequest(id, specs, opts), serializer);
}
Also used : LookupInOptions(com.couchbase.client.java.kv.LookupInOptions) JsonSerializer(com.couchbase.client.java.codec.JsonSerializer)

Aggregations

JsonSerializer (com.couchbase.client.java.codec.JsonSerializer)2 LookupInOptions (com.couchbase.client.java.kv.LookupInOptions)2 SubdocGetRequest (com.couchbase.client.core.msg.kv.SubdocGetRequest)1