But it returns no results, even though you know children exist. What is the likely error?
medium
A. The ExpressionAttributeValues syntax is incorrect
B. You should use KeyConditionExpression instead of FilterExpression
C. You need to query with ItemId = '5' instead
D. ParentId attribute is missing or named differently in items
Solution
Step 1: Check attribute naming
If ParentId attribute is missing or named differently, filter finds no matches.
Step 2: Verify attribute presence in items
Ensure all child items have ParentId attribute exactly named 'ParentId'. If not, query returns empty.
Final Answer:
ParentId attribute is missing or named differently in items -> Option D
Quick Check:
Attribute name mismatch causes no results [OK]
Hint: Check attribute names match exactly in query and items [OK]
Common Mistakes:
Confusing FilterExpression with KeyConditionExpression
Incorrect syntax in ExpressionAttributeValues
Querying by ItemId instead of ParentId
5. You want to retrieve the full hierarchy path from a child item up to the root using the adjacency list pattern in DynamoDB. Which approach is best?
hard
A. Use a DynamoDB join operation to combine parent and child items
B. Store the full path string in each item and query it directly
C. Iteratively query each item's ParentId until reaching the root
D. Use a single query filtering all items with ParentId equal to the child's ID
Solution
Step 1: Understand adjacency list limitations
Adjacency list stores only parent references, so full path is not stored.
Step 2: Retrieve full path by iterative queries
To get full path, query each item's parent repeatedly until root (ParentId null) is reached.
Step 3: Evaluate other options
Store the full path string in each item and query it directly is a different pattern (materialized path). Use a single query filtering all items with ParentId equal to the child's ID gets children, not parents. Use a DynamoDB join operation to combine parent and child items is invalid as DynamoDB has no join.
Final Answer:
Iteratively query each item's ParentId until reaching the root -> Option C
Quick Check:
Adjacency list needs iterative parent queries for full path [OK]
Hint: Follow parent links step-by-step to build full path [OK]
Common Mistakes:
Expecting DynamoDB to support joins
Assuming full path is stored in adjacency list
Trying to get full path with single query filtering children
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.