I use couchbase lite 1.4 on ios and i’m trying to upgrade to 3.0. i have a n1ql query i can run on the server, and i previously used a couchbase lite view on the ios app. i’m trying to get this to work in cbl 3.0 but i’m not able to get it working. anyone have ideas on how to make it work? in particular, the parallel arrays doesn’t seem to be working. i’m happy to use either sql++ or the query builder, whatever works.
here’s our document (simplifying a little bit):
docId: loc::1234
{
“delProfs”: [
{
“delProf”: {
“cds”: [
[
“1”,
“15”
],
[
“1”,
“15”
]
],
“routes”: [
“7442”,
“3000”
]
},
“start”: “2021-01-24”
}
]
}
I want to be able to pass in a date, route, and cd (“2023-04-01”, “7442”, “1”) and see all the docs which match. there’s a lot of nesting objects/arrays so i’m not sure how to write the query. i do have n1ql statement that we run on the server if it helps:
select meta(d).id
from dss d
where delProfs is not missing
AND ( ANY x in delProfs SATISFIES
( (ANY y in x.delProf.routes SATISFIES y=“$1” END)
AND (any z in ARRAY_RANGE(0,ARRAY_LENGTH(x.delProf.routes)) SATISFIES
x.delProf.routes[z]=“$1” AND ARRAY_CONTAINS(x.delProf.cds[z],“$2”) END)
) END)
in particular, cbl 3.0 doesnt seem to like this one:
any z in ARRAY_RANGE(0,ARRAY_LENGTH(x.delProf.routes))
i checked the link for which array functions aren’t supported for sql++ but i didn’t see these on the list. not sure if i need to replace this with something else?
3 posts - 3 participants