问题描述:

I have a key of type Number in a DynamoDB table. I set action as ADD to add a value to the existing value.

DynamoDBAttributeValue *attr =

[[[DynamoDBAttributeValue alloc] initWithN:@"1"] autorelease];

DynamoDBAttributeValueUpdate *attrUpdate =

[[DynamoDBAttributeValueUpdate alloc] initWithValue:attr andAction:@"ADD"];

Now, how do I subtract some value from the key?

网友答案:

You can set initWithN:@"-1" to substract 1 (or any value) from the attribute when using the ADD action.

I think you've misused the word key. Keys are immutable - only attributes can be updated.

相关阅读:
Top