Bird
0
0

Identify the error in this update mutation:

medium📝 Debug Q14 of 15
GraphQL - Mutations
Identify the error in this update mutation:
mutation { updateUser(input: {name: "Bob"}) { id name } }
AMissing the ID argument to specify which user to update
BInput object should be named 'data' instead of 'input'
CMutation keyword should be 'query' instead of 'mutation'
DCannot update the 'name' field
Step-by-Step Solution
Solution:
  1. Step 1: Check required arguments for update mutation

    Update mutations require an ID to identify the record to update.
  2. Step 2: Analyze the given mutation

    The mutation lacks the ID argument, so it cannot know which user to update.
  3. Final Answer:

    Missing the ID argument to specify which user to update -> Option A
  4. Quick Check:

    Update mutation must include ID argument [OK]
Quick Trick: Always include ID to update specific record [OK]
Common Mistakes:
  • Omitting the ID argument
  • Confusing input object name
  • Using 'query' instead of 'mutation'

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes