Skip to content

Commit 6e53cfe

Browse files
author
Michael Bahr
authored
Add an example for attribute updates
1 parent da68f46 commit 6e53cfe

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,19 @@ If you prefer to specify your own parameters, the optional third argument allows
876876

877877
**But wait, there's more!** The `UpdateExpression` lets you do all kinds of crazy things like `REMOVE` attributes, `ADD` values to numbers and sets, and manipulate arrays. The DynamoDB Toolbox has simple ways to deal with all these different operations by properly formatting your input data.
878878

879+
#### Updating an attribute
880+
881+
To update an attribute, include the key and any fields that you want to update.
882+
883+
```javascript
884+
let item = {
885+
id: 123,
886+
sk: 'abc',
887+
status: 'inactive',
888+
}
889+
await MyEntity.update(item)
890+
```
891+
879892
#### Removing an attribute
880893

881894
To remove attributes, add a `$remove` key to your item and provide an array of attributes or aliases to remove.

0 commit comments

Comments
 (0)