RomYk97
November 10, 2022, 8:54am
1
Hello I am facing the issue that I am trying to find element in array through subquery.
"SELECT META().id FROM adminDB
WHERE (Type = \'type\') AND ANY v in Versions SATISFIES v.id IN (*array with ids*) END"
EDIT:
(This works but I would prefer first one)
"SELECT META().id FROM adminDB
WHERE ANY v in Versions SATISFIES v.id IN (*array with ids*) AND (Type = \'type\') END"
But this query is throwing an N1QL syntax error.
Any ideas ?
RomYk97
November 10, 2022, 11:41am
2
Finally i found solution (brackets)
"SELECT META().id FROM adminDB
WHERE (Type = \'type\') AND ANY v in Versions SATISFIES (v.id IN (*array with ids*)) END"
vsr1
November 10, 2022, 1:27pm
3
Did not see it is couchbase Lite. Non Lite version can use following optimization.
IN List Handling Improvements in Couchbase Server 6.5 - The Couchbase Blog (Subquery handling and potential query rewrite)
RomYk97
November 11, 2022, 8:24am
4
Yes Im little bit disappointed by documentation of CBL especially with N1QL query creation through String not query builder. Im using it because it provides more freedom but many times i have to use try->error method.
But thanks for the effort