Updating data in GraphQL is performed using mutations that modify existing records on the server.
An update mutation identifies an existing entity (usually via id) and modifies one or more of its fields.
type Mutation {
updateUser(id: ID!, name: String!): User
}
updateUser → mutation fieldid → identifies the recordname → new valueUsermutation {
updateUser(id: "1", name: "Zeeshan Updated") {
id
name
}
}
{
"data": {
"updateUser": {
"id": "1",
"name": "Zeeshan Updated"
}
}
}