I have created a attribute of type String Set. When I create the Item and assign an attribute of type SS everything works. But when I try to update this attribute, the data type
An alternative simpler syntax
Upsert Item and Add "A" to set
const documentClient = new AWS.DynamoDB.DocumentClient();
await documentClient.update({
TableName,
Key: { hashKey, sortKey },
AttributeUpdates: {
'userIDs': {
Action: 'ADD',
Value: documentClient.createSet(['A' ])
},
},
}).promise();
Upsert Item and remove "A" from set
await documentClient.update({
TableName,
Key: { hashKey, sortKey },
AttributeUpdates: {
'userIDs': {
Action: 'DELTE',
Value: documentClient.createSet(['A'])
},
},
}).promise();