Deleting
Use store.remove()
to delete resources.
Deleting a Single Resource
In this example, we delete the books resource with an ID of 24.
Deleting Every Resource of a Type
Should you ever need to delete every resource of a specific resource type, you can also do that using remove()
.
Deleting Multiple Resources at Once
You can use remove
to delete more than one resource at a time. Here's an example that demonstrates deleting a handful of books, a pair of authors, and every movie:
Using update()
to Delete a Resource
update()
to Delete a ResourcePassing null
as a resource to store.update()
will delete the resource.
You may choose to use one over the other when it makes sense as part of a bulk operation.
For instance, in the following call to store.update()
, we are able to update the attributes of one resource while deleting another at the same time:
Had we used remove()
to delete the resource, we would have had to update the other resource in a separate call to update()
, which is why in this situation it made more sense to use update
to do both at the same time.
Last updated