Provides support to increase developer productivity in Java when using Couchbase. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.
We use something like this in our custom base repository:
final Mono<Long> totalCount = getReactiveCouchbaseOperations().findByQuery(getEntityInformation().getJavaType())
.withConsistency(buildQueryScanConsistency())
.matching(new Query().with(pageable))
.count();
final Mono<List<T>> pageContents = getReactiveCouchbaseOperations().findByQuery(getEntityInformation().getJavaType())
.withConsistency(buildQueryScanConsistency())
.matching(new Query().with(pageable))
.all()
.collectList();
// zip the two queries together to return the requested Page
return Mono.zip(pageContents, totalCount, (list, count) -> new PageImpl<T>(list, pageable, count))
.block();
We use something like this in our custom base repository: