couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nitin Borwankar <>
Subject reduce fn for grouping items with same key
Date Mon, 10 Aug 2009 06:48:11 GMT
Hello all,

I am trying to write a reduce function which  takes the map fn output

(k1, v11),
(k1, v12),
(k1, v13),
(k2, v21),
(k2, v22),

and produces as a result of the reduce

  k1: [v11,v12,v13],
  k2: [v21,v22],
  k3: [v31]

where v11 etc could themselves be lists and do not need to be unpacked in
the final result but can stay as nested list of lists.

But I am lost as far as the (keys, values, rereduce) signature.

So far I have managed by just reusing the return sum(values) on numeric
values, but this is different and I need some conceptual help with
reduce/rereduce for non-numeric values and grouping into lists instead of
taking the sum.

Thanks much,


37% of all statistics are made up on the spot
Nitin Borwankar

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message