Challenge - 5 Problems
Return Values Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate2:00remaining
What does
ReturnValues: "ALL_OLD" return on a PutItem?You perform a
PutItem operation with ReturnValues set to "ALL_OLD". What will the response contain if the item did not exist before?DynamoDB
PutItem({ TableName: "Users", Item: { UserId: "123", Name: "Alice" }, ReturnValues: "ALL_OLD" })Attempts:
2 left
💡 Hint
Think about what
ALL_OLD means when no item was replaced.✗ Incorrect
When ReturnValues is set to ALL_OLD in a PutItem, DynamoDB returns the old item attributes if the item existed. If the item did not exist, the response is empty.
❓ query_result
intermediate2:00remaining
What does
ReturnValues: "UPDATED_NEW" return on an UpdateItem?You run an
UpdateItem with ReturnValues set to "UPDATED_NEW". What will the response contain?DynamoDB
UpdateItem({ TableName: "Products", Key: { Id: "p1" }, UpdateExpression: "SET Price = :p", ExpressionAttributeValues: { ":p": 20 }, ReturnValues: "UPDATED_NEW" })Attempts:
2 left
💡 Hint
Focus on what
UPDATED_NEW means in the context of updated attributes.✗ Incorrect
UPDATED_NEW returns only the attributes that were changed by the update, with their new values.
📝 Syntax
advanced2:00remaining
Which
ReturnValues option is invalid for DeleteItem?Select the
ReturnValues option that will cause a syntax or runtime error when used with DeleteItem.DynamoDB
DeleteItem({ TableName: "Orders", Key: { OrderId: "o123" }, ReturnValues: ? })Attempts:
2 left
💡 Hint
Consider which return values make sense for a delete operation.
✗ Incorrect
UPDATED_NEW is invalid for DeleteItem because no attributes are updated during deletion.
🧠 Conceptual
advanced2:00remaining
Why use
ReturnValues: "ALL_NEW" in UpdateItem?What is the main reason to set
ReturnValues to "ALL_NEW" when updating an item?Attempts:
2 left
💡 Hint
Think about when you want to see the full updated item.
✗ Incorrect
ALL_NEW returns the entire item after the update, useful to confirm all changes.
🔧 Debug
expert3:00remaining
Why does this
UpdateItem with ReturnValues: "ALL_OLD" return empty?You run this
UpdateItem on a non-existing item with ReturnValues set to "ALL_OLD". Why is the returned attribute map empty?DynamoDB
UpdateItem({ TableName: "Inventory", Key: { ItemId: "i999" }, UpdateExpression: "SET Stock = :s", ExpressionAttributeValues: { ":s": 10 }, ReturnValues: "ALL_OLD" })Attempts:
2 left
💡 Hint
Consider what
ALL_OLD means when the item is new.✗ Incorrect
ALL_OLD returns the item attributes before the update. If the item did not exist, there are no old attributes to return, so the response is empty.