SELECT *, meta().cas FROM HRN2jDQDZl WHERE ( publisherTenantId.value = “publisherTenantId_1” OR ANY p IN publisherIds SATISFIES p.value = “publisherTenantId_1”) AND doc = “ScreenGroup” END
[
{
"code": 3000,
"msg": "syntax error - at )",
"query_from_user": "SELECT *, meta().cas FROM `HRN2jDQDZl` WHERE ( publisherTenantId.`value` = \"publisherTenantId_1\" OR ANY p IN publisherIds SATISFIES p.`value` = \"publisherTenantId_1\") AND doc = \"ScreenGroup\" END"
}
]
Did you tired back quotes around value due to reserve keyword
SELECT *, meta().cas
FROM HRN2jDQDZl
WHERE ( publisherTenantId.`value` = "publisherTenantId_1" OR
ANY p IN publisherIds SATISFIES p.`value`= "publisherTenantId_1")
AND doc = "ScreenGroup" END
Also doc is not referenced by array loop variable. If that is outside array you may want to move the condition outside ANY reduce cpu cycles.
I’m new to Couchbase, what do you mean by “move the condition outside ANY reduce cpu cycles.”
I think I made it work, I move END in ANY (I belive this is what you meant):
SELECT *, meta().cas
FROM lV1k6vmwVk
WHERE ( publisherTenantId.value = “publisherTenantId_1” OR
ANY p IN publisherIds SATISFIES p.value= "publisherTenantId_1"END)
AND doc = “ScreenGroup”
SELECT *, meta().cas
FROM lV1k6vmwVk
WHERE ( publisherTenantId.`value` = "publisherTenantId_1" OR
ANY p IN publisherIds SATISFIES p.`value`= "publisherTenantId_1" END
AND doc = "ScreenGroup");
ANY p IN publisherIds SATISFIES p.value= "publisherTenantId_1" END
Is Looping construct stops when condition is true or looping completed. If you add the condition that not depends on looping inside it keep evaluate each iteration. By moving outside it evaluates once.