Search code examples
springcouchbasespring-data-couchbase

Spring Data Couchbase - Search without having admin rights on the cluster


I'm currently working on a POC with Couchbase, using Spring Data to put & get documents on/off a bucket on a cluster.

As I'm working in a big company, I'm lucky they gave me a bucket, but still I don't have the admin rights on the cluster, so I only have access to the bucket.

But as I'm digging into the Spring Data documentation, I'm not able to find a way to retrieve documents without creating views on the server. (I'm getting errors like "Unknown query param" ). Nevertheless with couchbase java sdk i'm able to, through n1ql queries, but the use of the Spring data layer is mandatory.

The answers I found always point me to the server-side function direction ex : https://stackoverflow.com/a/30928169/3744307

What I would like to find, is a way to add a repository method like List findReceiptByAccount(String Account) without having to specificly declare the function server-side.

Is this possible, or have I to send a request to the administrators to create functions for me everytime I have to add a findByX method?

Thanks for your time,


Solution

  • With Spring Data Couchbase 2.x that would use a N1QL index in the background, and it would work with a single primary index (although having 1 index per repository entity class would be best for performance). Maybe you can ask your admin to create that index once?