A. The client object does not support getItem method
B. The TableName should be 'orders' in lowercase
C. GetItem requires a list of keys, not a single key
D. The key attribute name 'orderId' does not match the table's primary key name
Solution
Step 1: Check key attribute name case sensitivity
DynamoDB keys are case sensitive and must exactly match the primary key attribute name defined in the table schema.
Step 2: Identify mismatch in key name
If the table's primary key is 'OrderId' (capital O), using 'orderId' (lowercase o) causes an error because the key is incorrect.
Final Answer:
The key attribute name 'orderId' does not match the table's primary key name -> Option D
Quick Check:
Key names must match exactly [OK]
Hint: Match key attribute names exactly, including case [OK]
Common Mistakes:
Ignoring case sensitivity in key names
Assuming TableName is case insensitive
Thinking GetItem needs multiple keys
5. You want to fetch a single item from a DynamoDB table 'Employees' where the primary key is a composite key: DepartmentId (partition key) and EmployeeId (sort key). Which GetItem call is correct?
hard
A. client.getItem({ TableName: 'Employees', Key: { EmployeeId: 'E123' } })
For tables with composite keys, both partition key and sort key must be provided in the Key object to uniquely identify the item.
Step 2: Analyze the Key parameter
The correct call must include both DepartmentId (partition key) and EmployeeId (sort key) as named properties in the Key object. Providing only one key or incorrect syntax like non-named values will fail.