dynamodb update incr The provided expression refers to an attribute that does not exist in the item
update_err:
ValidationException: The provided expression refers to an attribute that does not exist in the item
status code: 400, request id: LNC41OG6596V2CTPUOVHNRB8CJVV4KQNSO5AEMVJF66Q9ASUAAJG
原本使用的语句:
{
TableName: "Music",
Key: {
"Artist":"No One You Know",
"SongTitle":"Call Me Today"
},
UpdateExpression: "SET Plays = Plays + :incr",
ExpressionAttributeValues: {
":incr": 1
},
ReturnValues: "UPDATED_NEW"
}
TableName: "Music",
Key: {
"Artist":"No One You Know",
"SongTitle":"Call Me Today"
},
UpdateExpression: "SET Plays = Plays + :incr",
ExpressionAttributeValues: {
":incr": 1
},
ReturnValues: "UPDATED_NEW"
}
红色标记地方并不能执行成功,修改为:
UpdateExpression: aws.String("ADD play :incr"), 即可
尝试了三个小时,最后在官方论坛上发现解决方法
https://forums.aws.amazon.com/message.jspa?messageID=629222