Bird
0
0

Given this mutation call:

medium📝 query result Q4 of 15
GraphQL - Mutations
Given this mutation call:
mutation { createPost(title: "Hello", content: "World") { id title } }

What fields will be returned in the response?
AOnly the id field of the new post
BBoth id and title fields of the new post
CAll fields of the new post
DNo fields, just a success message
Step-by-Step Solution
Solution:
  1. Step 1: Look at requested return fields

    The mutation requests { id title } after createPost, so these fields will be returned.
  2. Step 2: Understand GraphQL response

    GraphQL returns only requested fields, so only id and title are included.
  3. Final Answer:

    Both id and title fields of the new post -> Option B
  4. Quick Check:

    Requested fields = Returned fields [OK]
Quick Trick: Returned fields match requested fields in mutation [OK]
Common Mistakes:
  • Assuming all fields return by default
  • Expecting a success message instead of fields
  • Ignoring requested fields in mutation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes