i need sample query for array fields in spring data couchbase for jpa
Hello,
What version of the SDC (Spring Data Couchbase) are you using (3 or 4)?
Thanks
Aaron
Hi @biozal ,
I am using spring data couchbase 4.3.3.
my document is
“user_document”: {
“employee”: [
“productmanager”,
“architect”,
“developer”
],
“employeename”: “vel”,
“employeeaddress”: “india”
}
now i need a query for emplyee array from spring data couchbase 4.3.3
@Query(
“SELECT META(TD1).id AS __id, META(TD1).cas AS __cas,”
+ "* from #{n1ql.bucket} AS TD1 WHERE "
+ "TD1.employeename = $1 AND "
+ "ANY app IN TD1.employee SATISFIES app in $2 END "
+ “limit 1”)
TestDocument findByEmployeeNameAndEmployeeIn(
String employeename, JsonArray users);
I have tried this query but query returns null or 0.
Hi @mreiche , do you have any idea ?
I instead of projecting *, project TD1.*
I’m about 90% confident that is the issue…
You can run the queries in the couchbase web console to see the difference.