Want to add 2 more users in both the group. But it is but working as excepted.
couchbase version --4.6.2-3095 enterprise edition
sql— UPDATE app SET localUserGroup.users = ARRAY_APPEND(localUserGroup.users,$1)
FOR localUserGroup in policyGroup.localUserGroups
FOR policyGroup in policyGroups
WHEN policyGroup.name = $2 AND localUserGroup.name = $3
WHERE META(app).id = $4`
Qualifies only one localUseGroup , you have different names.
If need to add new users for all the user usergroups change to WHEN policyGroup.name = $2 END or make it OR/IN on both names (WHEN policyGroup.name = $2 AND localUserGroup.name IN $3 END, supply $3 as [“localGroup1”, “localGroup2”])
What are the query parameter values and what is expected updated document and what actually happening.