Deleting data in GraphQL is performed using mutations that remove existing records from the server.
A delete mutation typically requires an identifier (e.g., id) to locate the record and remove it.
type Mutation {
deleteUser(id: ID!): Boolean
}
deleteUser → mutation fieldid → identifies the recordBoolean to indicate successmutation {
deleteUser(id: "1")
}
{
"data": {
"deleteUser": true
}
}
Sometimes the deleted object is returned instead of a boolean: