SELECT * FROM USE INDEX() WHERE docType=‘group’ AND lower(groupName) LIKE lower(’%team1\_%’) ORDER BY groupName LIMIT 10 OFFSET 0;
I ran the above query against the couchbase DB directly and it is giving the expected result.Whereas while querying the same through the node sdk it is not returning any results which is a weird behaviour.I think it is a bug in the node sdk.
this._cluster = new Couchbase.Cluster(this._settings.connectionString);
const fullQuery = "SELECT * FROM <bucketname> WHERE docType='x' AND lower(xName) LIKE lower("+name+") ORDER BY xName"
const nQuery = N1qlQuery.fromString(fullQuery)
return retryHelper.retryOnError(this._bucket.query, this._bucket, nQuery);
Does this query run correctly in the Couchbase Console? If not, then it is indeed possible that there is a client bug that is causing this. Can you provide some additional details on what Node.js version and Server version you are using?
We cannot seem to identify any possible cause for your query to not work. The query statements are sent directly to the server once they reach the toObject() stage of execution. Are you certain that you’re escaping of the query is correct and that the result of the toObject() call works in the Couchbase Console without any modification (but fails in the SDK).
Yes I am certain about it.I even checked the SDK myself I also got stuck as the SDK directly passes the query to the server.And yes the query passes successfully in the console but fails through the SDK.
Before you run your application, can you try and set the environment variable LCB_LOGLEVEL to 9, and then run your application again, and then paste the logs messages once the error occurs? Also, can you tell me what errors are being returned by the SDK, or are there no errors, and just no results. Also, are you sure you’re running the application against the correct bucket with the correct credentials?