我有一个列为“Name”和“Vote”的表,每当我更新_item时,我想增加投票数。我尝试了下面的问题,但没有运气。在
db.update_item(Key={ "Name":"Dany"},
UpdateExpression='ADD #oldVote :newVote',
ExpressionAttributeNames={ '#oldVote' :'Vote'},
ExpressionAttributeValues={':newVote': {"N": "1"}}
)
获取错误为:
"An error occurred (ValidationException) when calling the UpdateItem operation: Invalid UpdateExpression: Incorrect operand type for operator or function; operator: ADD, operand type: MAP"
请尝试下面的更新。它应该能解决问题。在
您可以尝试以下操作:
来源:http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html#WorkingWithItems.AtomicCounters
相关问题 更多 >
编程相关推荐