All EventTypes, All Categories

Except for reading $all - is there any way to get a list of all event types or all categories that are present in an EventStore cluster?

You could do this with a projection.

fromAll()
.when({
$init:function(){
return { Streams: {}, EventTypes: {} };
},
$any: function(s,e){

    s.Streams[e.streamId] = (s.Streams[e.streamId] || 0) + 1;
    s.EventTypes[e.eventType]= (s.EventTypes[e.eventType] || 0) + 1;
    return s;
}

})

``

gives me:

{
  "Streams": {
    "X-1": 24000,
    "Z-1": 30000,
    "A-1": 10000,
    "B-1": 20000,
    "C-1": 40000
  },
  "EventTypes": {
    "TestEventType": 124000,
    "$metadata": 6
  }
}

I assume this is expected - I will have to reproduce the logic of the $by_category and $by_event_type projections to retrieve the stream names (trivial but not ideal if I am customising my $by_category delimiter etc - ideally I’d like to just list stream names)

Cheers

JC