-
Notifications
You must be signed in to change notification settings - Fork 110
Open
Description
Hi,
Can you add support of ReturnValuesOnConditionCheckFailure parameters in putItem,updateItem,batchWriteItem ...
https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ConditionCheck.html
When the API thrown an error with code = 'ConditionalCheckFailedException'
Then the err include an "Item" containing the document in the db:
const cli = new AWS.DynamoDB({region:'local', endpoint: process.env.MOCK_DYNAMODB_ENDPOINT})
try {
await cli.putItem({TableName: 'X', Item: {_id:{S:'test'}, v:{N:"1"}}}).promise()
await cli.putItem({TableName: 'X', Item: {_id:{S:'test'}, v:{N:"3"}}
ReturnValuesOnConditionCheckFailure: 'OLD_OLD',
ExpressionAttributeNames: {'#V' : 'v'},
ConditionExpression: '#V = :V',
ExpressionAttributeValues: {':V':{N:"2}}
}).promise()
} catch (err) {
console.debug(err.code, err.Item)
// Item = { _id : {S: "test"}, v: {N: "1}}
}
It works when I use the real dynamodb directly, and failed with this module or the dynamodb local provided by amazon.
this feature were release in july this year.
Thanks
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels