While the batch operations we learned about in chapter 18 provide the ability to delete several resources with a single API call, there’s an underlying requirement that we must know in advance: the unique identifiers of the resource we want to delete. However, there are many scenarios where we’re not so much interested in deleting a specific list of resources but instead are more interested in deleting any resources that happen to match a specific set of criteria. This design pattern provides a mechanism by which we can safely and atomically remove all resources matching certain criteria rather than by a list of identifiers.
As is evident from chapter 18, it’s not all that uncommon to want to operate on more than one resource at a time. More specifically, we might want to clear out a set of specific resources. However, compared to the other batch operations, deletion is by far the most straightforward, requiring no other information to perform an action: given an ID, remove the resource.