Deleting an object
You want to delete an existing object in your database through the Parse GraphQL API.
Using the parse GraphQL, there are two different ways to delete an existing object in your database:
- Using class mutation - this is the recommended mutation that you should use to delete an object of a specific class.
Depending on the version of Parse you choose to run, the GraphQL queries, mutations and results will be slightly different. Please choose the correct example along with the Parse version you are running.
When you use the delete generic mutation, you send the object’s className and objectId, and Parse Server will delete this object.
Therefore, the objects’ delete generic mutation is the one that you can use for deleting an existing object of any class. If you want to delete an existing object of a specific class, we recommend using the class mutation.
This example will only work if you use a className and an objectId of an existing object. You can create an object using the creating an object recipe.
Parse 3.9.0 and later does not have the generic method DELETE. You must use the specific methods below to delete objects.
Once you have already created your object’s class in your application’s schema (for instance, using the creating an object recipe), Parse Server instantly adds to your GraphQL API a new delete<ClassName> mutation to delete an existing object of this class.
Therefore, the object’s class mutation is the recommended method for deleting an existing object of a specific class.
This example will only work if you use a objectId or id of an existing object. You can create an object using the creating an object recipe.