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 20:28:38 GMT
> I do not like the resulting format.

MapReduce is about optimizing algorithms
not about formatting.

If you really need formatting, create a list:

function(head, req) {
  var result = {}
  while (r = getRow()) {
    result[r.key] = r.value;
  }
  send(JSON.stringify(result));
}

This should work. However, this simple implementation is not memory savvy.
Send row one by one for better memory management.
And if you really need high performance, forget formatting.


Regards,

Aurélien
Mime
View raw message