Couchbase lite 3.0 - N1QL syntax error

Hello,
Can someone explain me why I got syntax error on the following query:

SELECT DISTINCT name as label FROM _ WHERE documentType=‘Location’ AND
meta().id IN [“SOME ID HERE”,“SOME ID HERE”]

Error: N1QL syntax error near character 85

This is basicly the same query as on the SQL++ Differences (USE KEYS feature)
(SQL++ Differences | Couchbase Docs)

I checked the behavior on my own. I used Android Java SDK 3.0.0.

With the following query…

SELECT META().id FROM _ WHERE META().id IN ['feeec080-91ef-44b2-ac66-d28fd100fc60','0a6ebe85-298b-4e25-b80e-380ac1c96521']

I faced the following error…

W/System.err: CouchbaseLiteException{CouchbaseLite,23,'N1QL syntax error near character 44
       (CouchbaseLite Android v3.0.0-192@31 (CE/release, Commit/unofficial@1f4001b9647c Core/3.0.0 (192) at 2022-01-27T02:25:59.415601Z) on Java; Android 10; Android SDK built for x86)'}
        at com.couchbase.lite.N1qlQuery.prepQueryLocked(N1qlQuery.java:54)
        at com.couchbase.lite.AbstractQuery.getC4QueryLocked(AbstractQuery.java:206)
        at com.couchbase.lite.AbstractQuery.getC4Query(AbstractQuery.java:186)
        at com.couchbase.lite.N1qlQuery.compile(N1qlQuery.java:57)
        at com.couchbase.lite.AbstractDatabase.createQuery(AbstractDatabase.java:656)
        at com.couchbase.lite.Database.createQuery(Database.java:30)

When I just tried to use (...) instead of [...] as follows…

SELECT META().id FROM _ WHERE META().id IN ('feeec080-91ef-44b2-ac66-d28fd100fc60','0a6ebe85-298b-4e25-b80e-380ac1c96521')

I got a successful result.

This is just a fact that I observed but I hope this helps.

1 Like

The documentation is incorrect and should be fixed. I believe I filed a report about this already but it might have been on another page. I will file another to make sure.

1 Like

This works, thank you.