Skip to content

Instantly share code, notes, and snippets.

@RafalWilinski
Created January 22, 2023 19:10
Show Gist options
  • Save RafalWilinski/1d7748f5746a5318910793e1591a2aad to your computer and use it in GitHub Desktop.
Save RafalWilinski/1d7748f5746a5318910793e1591a2aad to your computer and use it in GitHub Desktop.
// First, get the item
DynamoDB.get({
TableName: "http-crud-tutorial-items",
Key: {
id: "1",
},
}).promise().then((data) => {
const item = data.Item;
// Update the item
DynamoDB.put({
TableName: "http-crud-tutorial-items",
Item: {
...item,
assets: {
...(item.assets || {}),
token: {
quantity: "3",
},
},
},
}).promise().then(() => {
console.log('Updated item')
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment