tldr; Created a stream with some events, partitioned that stream, state of fromCategory
is not working.
I played a bit with EventStore, and created some events calle NoteAdded
in there. These events’ data object is just like {id: 'one|two|three|...}
. I can see them in the stream n2
in the web interface.
Then, I run a query like this:
fromStream('n2')
.when({
$init: function(s,e) {
return {count:0}
},
$any: function (s,e) {
s.count++;
return s;
}
})
which produces a correct result: {"count": 4}
.
Next, I created a projection ("repN2
", Continuous, Emitting allowed) like so:
fromStream('n2')
.when({
$any: function(state, ev) {
linkTo('n2c-' + ev.data.id, ev)
}})
The result, is as expected: I see several streams like n2c-one
etc. in the web interface.
Now, I want to use the fromCategory
selector, so I created a new projection (stateCatN2
, Continuous, emitting allowed) like that:
fromCategory('n2c').foreachStream()
.when({
$init: function(s,e) {
return {count:0}
},
$any: function (s,e) {
s.count++;
return s;
}
})
In the projection view of the web interface I see no state, no result.
However, I expect that I could get something like http://localhost:2113/projection/stateCatN2/state?partition=one
to give me a {count: 1}
. However, when I GET
this url, I get a response code of 200
, but an empty body.
System built-in projections like $by_category
are all running.
What am I missing here?