-1

It was a typo in my original question. Below is what i have observed.

My query looks like this -

String query = select * from table1 where guid is not missing and doc_type='xyz' and (guid in $guid_list);

I have my guid_list as below - List listOfGuid = new ArrayList<>(); listOfGuid.add("a1b3594f-0b76-4c54-8206-db2c16286320");

com.couchbase.client.java.document.json.JsonObject placeHolders = com.couchbase.client.java.document.json.JsonObject.create() .put("guid_list", JsonArray.from(listOfGuid));

N1qlQuery statement = N1qlQuery.parameterized(query,placeHolders);

This doesnt work. But if i try to pass the guid_list with single quote and hardcode the list in my query it works fine. Not sure why it doesnt work when i pass it as list. Is it because when i pass as list it goes in as double quotes ["a1b3594f-0b76-4c54-8206-db2c16286320"] instead of ['a1b3594f-0b76-4c54-8206-db2c16286320'].

  • Possible duplicate of [N1ql -> IN operator does not work with other conditions](http://stackoverflow.com/questions/26686772/n1ql-in-operator-does-not-work-with-other-conditions) – Jerod Johnson May 19 '17 at 14:27

1 Answers1

0

The statement may not formed properly. Looks like there is missing quotes. The following is curl command. curl -v http://localhost:8093/query/service -H "Content-Type: application/json" -d '{"statement":"select * from table1 where doc_type=\"xyz\" AND guid in $guid_list;","$guid_list":["123","234"]}'

vsr
  • 7,149
  • 1
  • 11
  • 10