Skip to content

Instantly share code, notes, and snippets.

@organizm
Last active April 5, 2019 09:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save organizm/bf1ce550f80698e2a76f05c9c91eb72b to your computer and use it in GitHub Desktop.
Save organizm/bf1ce550f80698e2a76f05c9c91eb72b to your computer and use it in GitHub Desktop.
[Remove nested attribute in DynanmoDB]#DynanmoDB
let docClient = new AWS.DynamoDB.DocumentClient();
let params = {
TableName : "customer",
Key : {
"customerId": "customer_001"
},
UpdateExpression : "REMOVE address.street3",
ReturnValues : "UPDATED_NEW"
};
console.log("Updating the item...");
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));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment