Flux not working with latest spring data couchbase 4.1.2

Hi

I have the below class in my project, executing below method throws, though I have Flux and not Mono in my return type.
If the query returns only 1 document it works, but fails when query returns more than a single document.
Have anyone faced such issue with this version of spring data couchbase?

java.lang.IndexOutOfBoundsException: Source emitted more than one item
at reactor.core.publisher.MonoSingle$SingleSubscriber.onNext(MonoSingle.java:136) ~[reactor-core-3.4.1.jar:3.4.1]
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:

@Repository
public interface PolicySnapshotCBRepository extends ReactiveSortingRepository<PolicySnapshot, String> {

@Query("#{#n1ql.selectEntity} WHERE #{#n1ql.filter} AND entity.state = $1 "
        + "AND ANY type IN entity.applicableEntities SATISFIES type IN $2 END ")
Flux<PolicySnapshot> findAllPoliciesByApplicableTypes(String state, JsonArray applicableTypes);

}

@deniswsrosa /@mreiche can you please assist !

hi @sri_ram -
The latest spring-data-couchbase is 4.1.7, can you try with that please? I am able to do this:

@Query("#{#n1ql.selectEntity} where #{#n1ql.filter} and iata = $1")
@ScanConsistency(query = QueryScanConsistency.REQUEST_PLUS)
Flux<Airport> getAllByIata(String iata);

vie = new Airport("airports::vie", "vie", "loww");
vie1 = new Airport("airports::vie1", "vie", "loww");
airportRepository.save(vie).block();
airportRepository.save(vie1).block();
List<Airport> airports0 = airportRepository.getAllByIata("vie").collectList().block();
assertEquals(2, airports0.size());
  • Mike

@mreiche Thanks.

Apologies for late reply, spring-data-couchbase 4.1.5 fixed the issue. However, I don’t see release of 4.1.7 in central maven repository.