A. The resolver should not use filter on postsData.
B. The resolver is missing the parent argument as the first parameter.
C. The resolver should use context instead of args.
D. The resolver function name should be Posts with uppercase P.
Solution
Step 1: Check resolver function parameters
The resolver function must have parent as the first argument to access parent data.
Step 2: Identify misuse of args instead of parent
The code incorrectly uses args.id instead of parent.id to filter posts.
Final Answer:
The resolver is missing the parent argument as the first parameter. -> Option B
Quick Check:
Parent argument must be first in resolver [OK]
Hint: Always include parent as first resolver argument [OK]
Common Mistakes:
Using args instead of parent for parent data
Ignoring resolver parameter order
Assuming function name case matters
5. You want to fetch a list of books with their authors' names using nested resolvers. The Book type has an authorId field, and the Author type has id and name. How should you use the parent argument in the author resolver inside Book to get the correct author name?
hard
A. Use parent.authorId to find the author by matching id.
B. Use args.authorId to find the author by matching id.
C. Use context.authorId to find the author by matching id.
D. Use info.authorId to find the author by matching id.
Solution
Step 1: Understand nested resolver data flow
The author resolver inside Book receives the book object as parent.
Step 2: Access authorId from parent to find author
Use parent.authorId to look up the author by matching id in authors data.
Final Answer:
Use parent.authorId to find the author by matching id. -> Option A
Quick Check:
Parent holds book data, use parent.authorId [OK]
Hint: Parent holds book; use parent.authorId for author lookup [OK]
Common Mistakes:
Using args instead of parent for authorId
Trying to get authorId from context or info
Ignoring parent argument in nested resolver
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.