I have a few docs that look like this:
{userId: 123, msg:{ timestamp:123456, event:"actionA"} }
{userId: 123, msg:{ timestamp:123466, event:"actionB"} }
etc...
Fn map:
emit(doc.userId, [doc.msg])
Decrease fn:
return [].concat.apply([], vs)
These functions seem to do what I expect, so I thought I would see output like:
Key: 123, Value: [{timestamp:123456, event:"actionA"}, {timestamp:123466, event:"actionB"}, ...etc...]
But I get an overflow error while shrinking: "Slow performance should shrink faster." Indeed, couchdb docs say that "typically, the reduction function should come down to a single scalar value" .... "CouchDB will give you a warning if you try to use the" wrong path ".
So, I assume I'm using Couch MR in the “wrong way”. What will be the “right path” for such a calculation?
source
share