Introduction
When you add or change data in a table, you might want to see what was changed or what the old data looked like. Return values on write let you get this information right away.
Jump into concepts and practice - no test required
ReturnValues = "NONE" | "ALL_OLD" | "UPDATED_OLD" | "ALL_NEW" | "UPDATED_NEW"
PutItem with ReturnValues = "NONE"
UpdateItem with ReturnValues = "ALL_NEW"
DeleteItem with ReturnValues = "ALL_OLD"
UpdateItem {
TableName: "Users",
Key: { "UserId": { S: "123" } },
UpdateExpression: "SET Age = :newAge",
ExpressionAttributeValues: { ":newAge": { N: "30" } },
ReturnValues: "UPDATED_NEW"
}ReturnValues parameter do in a DynamoDB write operation?ReturnValues?{
TableName: "Users",
Key: { "UserId": "123" },
UpdateExpression: "SET Age = :newAge",
ExpressionAttributeValues: { ":newAge": 30 },
ReturnValues: "UPDATED_NEW"
}{
TableName: "Products",
Item: { "Id": "001", "Name": "Pen" },
ReturnValues: "UPDATED_OLD"
}ReturnValues option should you use in your UpdateItem call?