Bird
0
0

You want to test a query in GraphQL Playground that fetches a list of books with their titles and authors, but only those published after 2010. Which query is correct?

hard📝 Application Q9 of 15
GraphQL - Basics and Philosophy
You want to test a query in GraphQL Playground that fetches a list of books with their titles and authors, but only those published after 2010. Which query is correct?
Aquery { books { title author } filter: { publishedAfter: 2010 } }
Bquery { books(publishedAfter: 2010) { title author } }
Cquery { books { title author where published > 2010 } }
Dquery { books { title author publishedAfter: 2010 } }
Step-by-Step Solution
Solution:
  1. Step 1: Understand argument filtering in GraphQL

    Arguments to filter data are passed inside parentheses after the field name.
  2. Step 2: Identify correct syntax for filtering books

    query { books(publishedAfter: 2010) { title author } } correctly passes 'publishedAfter: 2010' as argument to 'books' field.
  3. Final Answer:

    query { books(publishedAfter: 2010) { title author } } -> Option B
  4. Quick Check:

    Filtering = Argument inside parentheses after field [OK]
Quick Trick: Pass filters as arguments inside parentheses after field name [OK]
Common Mistakes:
  • Trying to filter inside field braces
  • Using 'where' or 'filter' incorrectly
  • Placing filter as a separate field

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes