I'm trying to query a spring-data couchbase repository using N1QL queries. I have two doubts:
I'm using @Query annotation to generate queries, my code looks like this:
@Query("#{#n1ql.selectEntity} WHERE $0 = $1 AND #{#n1ql.filter}")
public Page<GsJsonStore> matchJson(String term, String value, Pageable pageable);
//Query
Page<GsJsonStore> p = repo.matchJson("_object.details.status", "ready", pg);
This query doesn't return any results. However, when I run the same query (below) in cbq I get the desired result:
select * from default where _object.details.status = 'ready';
How can I view the query string generated by the Couchbase repository? I'm using spring-boot. Am I correct in using the @Query annotation for this use-case?
Also, how can I perform n1QL queries on CouchbaseOperations
template? I know that there's a findByN1QL
method, but I didn't find any good documentation about it. Could someone please explain how to use this?