AWS.DynamoDB.DocumentClient does not provide a way to add number to Number Set.
Need to use lower api Class: AWS.DynamoDB — AWS SDK for JavaScript.
I've tried few times and figured out the sytax of ADD
operaion which is not desctibed in UpdateItem reference. Just put .ADD
, column name and value
See Modifying Items and Attributes with Update Expressions - Amazon DynamoDB for ADD
syntax.
Following code appends given numbers without making dupes.
dynamodb.updateItem({
"TableName" : "mytable",
"Key" : {
"Id": {"S": uuid},
},
"UpdateExpression" : "ADD setname :valuesToAdd",
"ExpressionAttributeValues" : {
": valuesToAdd" : { "NS": ["440"] }
},
ReturnValues:"UPDATED_NEW"
});