在一个N1QL(Couchbase)中使用设置和取消设置

时间:2019-02-17 18:58:53

标签: n1ql

我有此文档,需要取消setState数组并将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 *;

1 个答案:

答案 0 :(得分: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 *;

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