【发布时间】:2020-05-09 21:46:12
【问题描述】:
我尝试在 UpdateExpression 中使用 ADD 将电子邮件字符串添加到字符串集中,代码如下,但遇到了这个异常: Invalid UpdateExpression: Incorrect operand type for operator or function;运算符:ADD,操作数类型:LIST。
我认为关键是我需要一种将类型更改为 "string set" 的方法,但不确定实现此目的的语义是什么。
response = wishesTable.update_item(
Key={
'title': wishTitle,
'userMail': wishUsermail
},
UpdateExpression='ADD whoLikeList :my_value',
ExpressionAttributeValues={
":my_value": [userEmail]
},
ReturnValues="UPDATED_NEW"
)
【问题讨论】:
标签: amazon-dynamodb