use of com.couchbase.client.java.kv.IncrementOptions in project couchbase-jvm-clients by couchbase.
the class ReactiveBinaryCollection method increment.
/**
* Increments the counter document by one or the number defined in the options.
*
* @param id the document id which is used to uniquely identify it.
* @param options custom options to customize the increment behavior.
* @return a {@link CounterResult} once completed.
* @throws DocumentNotFoundException the given document id is not found in the collection.
* @throws TimeoutException if the operation times out before getting a result.
* @throws CouchbaseException for all other error reasons (acts as a base type and catch-all).
*/
public Mono<CounterResult> increment(final String id, final IncrementOptions options) {
return Mono.defer(() -> {
notNull(options, "IncrementOptions", () -> ReducedKeyValueErrorContext.create(id, async.collectionIdentifier()));
IncrementOptions.Built opts = options.build();
IncrementRequest request = async.incrementRequest(id, opts);
return Reactor.wrap(request, CounterAccessor.increment(core, request, id, opts.persistTo(), opts.replicateTo()), true);
});
}
Aggregations