Projections: count number or events in stream

Given a category $ce-order, how can one write a projection to count number of specific events per each stream in category. Documentation is sparse with very little guidance. I started with something like this. I need to find all orders that have more than one occurrence of specific event. Any help would be appreciated…

fromCategory(“order”)

.foreachStream()

.when({

$init:function(){

return {};

},

MyEvent: function(state,event){

}

});