Bird
0
0

You want to query a list of users with their posts and each post's comments text. Which query correctly achieves this?

hard📝 Application Q8 of 15
GraphQL - Queries
You want to query a list of users with their posts and each post's comments text. Which query correctly achieves this?
A{ users { id name posts comments { text } } }
B{ users { id name posts { title comments { text } } } }
C{ users { id name posts { title, comments.text } } }
D{ users { id name posts { title comments.text } } }
Step-by-Step Solution
Solution:
  1. Step 1: Understand nested query requirements

    We need users, their posts, and each post's comments text nested properly.
  2. Step 2: Check each option's correctness

    { users { id name posts { title comments { text } } } } correctly nests comments { text } inside posts. Others have syntax errors or wrong nesting.
  3. Final Answer:

    { users { id name posts { title comments { text } } } } -> Option B
  4. Quick Check:

    Proper nesting with braces = { users { id name posts { title comments { text } } } } [OK]
Quick Trick: Nest fields with braces to get related nested data [OK]
Common Mistakes:
  • Using dot notation for nested fields
  • Placing nested fields at wrong level
  • Using commas inside nested fields

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes