Hello,
i am new to event sourcing and trying to run query. fromStream('report_campaign-91468621')
runs fine but fromCategory
along with foreachStream
does not work and shows blank state.
Any idea’s what am i doing wrong?
fromStream('report_campaign-91468621')
// fromCategory('report_campaign')
// .foreachStream()
.when({
$init: function(state, ev) {
return { count: 0, clicks: 0, impressions: 0};
},
$any: function(state, ev) {
state.count++;
state.impressions += ev.body.reportCampaign.impressions;
state.clicks += ev.body.reportCampaign.clicks;
return state;
}
}).outputState();