couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Boermans <boerm...@gmail.com>
Subject Re: A reduce with multiple totals
Date Sat, 16 May 2009 12:46:54 GMT
2009/5/16 Patrick Antivackis <patrick.antivackis@gmail.com>:
> You should do like this :
>
>
> function(keys, values) {
>  var totalcallsfor = 0;
>  var totalanswered = 0;
> values.forEach(function(value) {
>    totalcallsfor = totalcallsfor + value.callfor;
>    totalanswered = totalanswered + value.answered;
> });
>  return {'callfor': totalcallsfor, 'answered':totalanswered};
> }

That works, Thank you Patrick.

Mime
View raw message