Spring Data Couchbase find from replica issue

We are planning to use Spring Data Couchbase but stuck at the lack of support towards querying replica nodes.

Going by the docs, I see that one has to use couchbaseTemplate to query on replica nodes. But I see that we need to do lot of redundant code to achieve this. Say I have a Spring repository method like this below.
@Query("#{#n1ql.selectEntity} WHERE role = 'admin' AND #{#n1ql.filter}") List<UserInfo> findAllAdmins();

If I have to retry this method using Couchbase Template, then one has to prepare a new Query object. The above Spring SpEL defined query is of no use while retrying using couchbaseTemplate.
SampleTemplate.findByQuery(entityClass).matching(new N1QLQuery())

So a developer has to frame two versions of Query to achieve this read from replica nodes use case ?

Hi @premvarmak - I answered your question here - Spring Data Couchbase find from replica issue · Issue #1375 · spring-projects/spring-data-couchbase · GitHub

2 Likes

Yes… Thank you… I got what I was looking for. I closed the issue there. and don’t know how to close here