在一个N1QL中使用Set和Unset(Couchbase)

问题描述 投票:0回答:1

我有这个文件,我需要取消设置orderState数组并将profileState设置为“AVAILABLE”。

我正在尝试这个N1QL语句,但它在END上抛出错误。

update ${BUCKET} as b unset b.orderState WHERE b.type = "ao.los:pro" and 
profileInformation.iccid="${ICCID}" and profileInformation.customerId is not 
missing limit 1 END, SET b.profileState="AVAILABLE" END returning *;
n1ql
1个回答
0
投票
UPDATE default AS b
SET b.profileState="AVAILABLE" UNSET b.orderState
WHERE b.type = "ao.los:pro"
      AND b.profileInformation.iccid = "ICCID"
      AND b.profileInformation.customerId IS NOT MISSING
LIMIT 1
RETURNING *;

update的语法:https://docs.couchbase.com/server/6.0/n1ql/n1ql-language-reference/update.html

© www.soinside.com 2019 - 2024. All rights reserved.