0

I have to create this N1QL couchbase query in Spring data

select... LIKE "TASK:100:%"

where 100 is a parameter, but I don't know if it is possible

@Query("#{#n1ql.selectEntity} where META().id like \"TASK:$1%:\" ")
List<Task> findTasks(String taskId);
deniswsrosa
  • 2,421
  • 1
  • 17
  • 25
Sandro Rey
  • 2,429
  • 13
  • 36
  • 80

1 Answers1

0

The correct syntax would be the following:

@Query("#{#n1ql.selectEntity} where META().id like ('TASK:' || $1 || '%') ")
List<Task> findTasks(String taskId);

Although I think you should concatenate the id on the backend instead of inside the query.

deniswsrosa
  • 2,421
  • 1
  • 17
  • 25