2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

How to add number to Number Set in DynamoDB

Last updated at Posted at 2017-01-31

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"
});

Refs

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?