couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hank Knight <hknight...@gmail.com>
Subject Re: CouchDB: Counting Total Occurrences of Unique Items
Date Sun, 28 Jul 2013 21:44:56 GMT
My map function is here:
function (doc) {
 if (doc.fruit) emit("fruit",doc.fruit);
}

My reduce function is here:
function (keys, values, rereduce){
   var r  = {};
   for (var f=0;f<values.length;f++) r[values[f]]?r[values[f]]++:r[values[f]]=1;
   return r ;
}

View it here::
https://zurv3aqzm.iriscouch.com/_utils/database.html?fruit/_design/zzz3/_view/zzz3#

I do not understand how to group the results.

Mime
View raw message