How to delete streams by name


I have created a lot of streams named MyStream-guid (for example MyStream-9a4d4665-8e5b-4c1e-97aa-aeb6715e745f)…

Is there a way to delete all streams where name have “MyStream” ?


There is not a way for instance to do DELETE MyStream-* we have considered doing such a thing. There are however some ways of doing this and we have at varying points even had outside tools that did these types of things in varying states.

So part of the issue with this (as a general case) is that you could literally end up with billions of results :open_mouth: I doubt you are in this case but it would need to be considered … So the easiest way to do ^^^ would be to enable the $streams projection (or write your own similar). This creates a stream, of streams (link event). This would allow you to just go through this stream to find all streams (it would then be a simple filter to get streams you were interested in no?). The same can be done easily with a read model to get the list of streams to delete.

In practice however this would rarely if ever be done to a production system. Instead it would likely be removed during the next upgrade which often includes taking events old store->new store and has a transformation process. I talk about this in a lot more detail in the versioning book … its free to read online (the whole book!)

The commercial tools do allow deleting streams based on a reflex. But as Greg points out, if that is millions of streams, ymmv

Greg, James, thank you both for your answers. I will take a look at the book!