incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Kempf <>
Subject Re: Problems with reduce in view appear when record size > 6
Date Thu, 30 Jul 2009 03:48:59 GMT
Hi Brian,

guessing that you refer to this page incremental
corresponding reduce function would be as follows, right (the final
reduce result is slightly changed, being a hash now)?
I am asking as I am still not absolutely firm with that topic...

map =>
  function(doc) {
  emit(doc["_id"], [doc["_id"], doc["_rev"], doc["var1"], doc["var2"],
doc["var3"], doc["var4"], doc["var5"]]);

reduce =>
  function(key, values, combine) {
        var result = {ids:[], revs:[], variables:[]}
          if (combine) {
            for (i in values) {
          } else {
            for (i in values) {
              result.variables.push([values[i][2], values[i][3],
values[i][4], values[i][5], values[i][6]]);
        return result;

> Yes, one of ids, revs or variables is undefined :-)
> You can use 'log' to see what values are being passed into your reduce
> function.
> As a guess, I'd say that a re-reduce operation is taking place: 'combine'
> will be true, 'key' will be null, and 'values' will be the output of a
> previous reduce operation.
> That is: your reduce function must be written in such a way as to be able
> to
> process values generated by a previous reduce function, as well as values
> emitted by a document. The Wiki talks about this further.

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