Skip to content

Instantly share code, notes, and snippets.

@torstenwerner
Created May 30, 2016 05:36
Show Gist options
  • Save torstenwerner/f678f1818e6750ed0198864a64e5b2ae to your computer and use it in GitHub Desktop.
Save torstenwerner/f678f1818e6750ed0198864a64e5b2ae to your computer and use it in GitHub Desktop.
const params = {
TableName: table,
Key: {
"year": year,
"title": title
},
UpdateExpression: "set info.rating = :r, info.plot=:p, info.actors=:a",
ExpressionAttributeValues: {
":r": 5.5,
":p": "Everything happens all at once.",
":a": ["Larry", "Moe", "Curly"]
},
ReturnValues: "UPDATED_NEW"
};
docClient.update(params, function (err, data) {
if (err) {
console.error("Unable to update item. Error JSON:", JSON.stringify(err, null, 2));
} else {
console.log("UpdateItem succeeded:", JSON.stringify(data, null, 2));
}
});
@torstenwerner
Copy link
Author

error message:
Object literal may only specify known properties, and 'UpdateExpression' does not exist in type 'UpdateParam'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment