Skip to content

Commit 41f60cf

Browse files
committed
add clarification of BatchWriteItem capabilities for dynamodb-toolbox#65
1 parent 6e9c3b5 commit 41f60cf

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,8 @@ The optional second argument accepts an `options` object. The following options
665665
| execute | `boolean` | Enables/disables automatic execution of the DocumentClient method (default: *inherited from Entity*) |
666666
| parse | `boolean` | Enables/disables automatic parsing of returned data when `autoExecute` evaluates to `true` (default: *inherited from Entity*) |
667667

668+
**NOTE:** The `BatchWriteItem` does not support conditions or return deleted items. *"BatchWriteItem does not behave in the same way as individual PutItem and DeleteItem calls would. For example, you cannot specify conditions on individual put and delete requests, and BatchWriteItem does not return deleted items in the response."* ~ [DynamoDB BatchWriteItem API](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchWriteItem.html)
669+
668670
```javascript
669671
const result = await Default.batchWrite(
670672
[

classes/Entity.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ class Entity {
271271
} // end delete
272272

273273
// Shortcut for batch operations
274+
// Only Key is supported (e.g. no conditions) https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchWriteItem.html
274275
deleteBatch(item={}) {
275276
const payload = this.deleteParams(item)
276277
return { [payload.TableName] : { DeleteRequest: { Key: payload.Key } } }
@@ -692,6 +693,7 @@ class Entity {
692693
} // end put
693694

694695
// Shortcut for batch operations
696+
// Only Item is supported (e.g. no conditions) https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchWriteItem.html
695697
putBatch(item={}) {
696698
const payload = this.putParams(item)
697699
return { [payload.TableName] : { PutRequest: { Item: payload.Item } } }

0 commit comments

Comments
 (0)