Here’s my very simple setup:
EventStore 3.0.1 on Windows x64
–run-projections=all
link_ticket_events:
fromCategory(‘event’)
.foreachStream()
.when({
‘TicketCreated’: function (state, event) {
linkTo(‘ticketevents-’ + event.body.eventId, event);
}
});
calculate_ticket_counts:
fromCategory(‘ticketevents’)
.foreachStream()
.when({
$init: function () {
return {
count: 0
};
},
TicketCreated: function (state, event) {
state.count += 1;
}
});