I'm trying to update an item using updateExpression, and i'd like to edit an attribute and delete another attribute on the same object, but i get the following error:
Invalid UpdateExpression: Syntax error; token: EOF near: "attributeToDelete"
I have to admit i wrote the update expression guessing the proper way to use it (failing). Here's the code snippet:
dynamodb.updateAsync({
TableName: `myTable`,
Key: { id: req.params.id },
UpdateExpression: 'SET attributeToEdit = :newValue DELETE attributeToDelete',
ExpressionAttributeValues: { ':newValue': 'valueToSet' },
})
How am i supposed to write an UpdateExpression when I want to include more than a action? (where actions are -> SET, DELETE, REMOVE, ADD)
via Koop4
No comments:
Post a Comment