Skip to content

Commit 7d4428b

Browse files
authored
Merge pull request dynamodb-toolbox#72 from bahrmichael/master
Add an example for attribute updates
2 parents 4cbb92a + 6e53cfe commit 7d4428b

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
@@ -878,6 +878,19 @@ If you prefer to specify your own parameters, the optional third argument allows
878878

879879
**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.
880880

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

883896
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)