Hello! I wanted to find the longest stream, so I’ve created the following projection
fromAll()
.when({
$init: function()
{
return\ {
max: 0,
sname: “”
};
},
$any: function(s, e) {
if (e.sequenceNumber > s.max)
{
s.max = e.sequenceNumber;
s.sname = e.streamId;
}
}
});
``
now it has returned the length of 999999 pointing to a strea which is around 2 500 000 long …
did I make any wrong assumption when creating this projection?