incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aurélien Bénel <aurelien.be...@utt.fr>
Subject Re: CouchDB: Counting Total Occurrences of Unique Items
Date Sun, 28 Jul 2013 17:48:19 GMT
Hi Hank,

> For performance reasons, should anything be moved from the reduce function to the map
function or to an additional reduce function?


Indeed. 

Here is my tip: always try to change your map so that you can use a builtin reduce function.

MAP
===

function (o) {
  if (o.fruit) {
    emit(o.fruit, null)
  }
}

REDUCE
======

_count


In the case you wouldn't like the resulting format, use a list on it. 


Regards,

Aurélien 
Mime
View raw message