Bird
0
0

What will be logged by the following DynamoDB get operation if the item with key 'OrderId' = '999' does not exist?

medium📝 Predict Output Q5 of 15
AWS - DynamoDB
What will be logged by the following DynamoDB get operation if the item with key 'OrderId' = '999' does not exist?
const params = { TableName: 'Orders', Key: { OrderId: { S: '999' } } };
const data = await client.get(params);
console.log(data.Item);
Aundefined
BAn empty object {}
CAn error indicating item not found
Dnull
Step-by-Step Solution
Solution:
  1. Step 1: Understand get operation output

    If the item does not exist, the Item property in the response is undefined.
  2. Step 2: Logging data.Item

    Logging data.Item will output undefined in JavaScript.
  3. Final Answer:

    undefined -> Option A
  4. Quick Check:

    Get returns undefined if item missing [OK]
Quick Trick: Get returns undefined if item missing [OK]
Common Mistakes:
MISTAKES
  • Expecting an error when item is missing
  • Assuming an empty object is returned
  • Confusing with null return value

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes