Hello,
I’m new to EventStore. I’ve been trying to use the projections example, from multiple streams. I named the streams user-(uuid4) and each of them has one UserCreated event.
The problem is that userCount does not increase. On the projection page both state and results are empty, but when I go to debug and do step-by-step, I see the initial state as 0, but no matter how many events I play, it doesn’t change.
On debug mode, I can see the event list in the category properly and every time I run a step it gets reduced. I tried to console.log before and after the increment and the variable is being properly changed, but it seems that the scope is local.
I’m following this approach (http://docs.geteventstore.com/introduction/3.8.1/projections/):
fromCategory('user')
.foreachStream()
.when({
'$init': function(state, ev) {
return { userCount: 0 }
},
'UserCreated': function(state, ev) {
state.userCount++
}
})