title: couchbase Reduce gives not wanted result
body: <p>I have a map function that returns a result like this :</p>
  
  <pre><code>{"total_rows":100995,"rows":[
  {"id":"00001_372792","key":["00001","CADENCIER",0],"value":-0.1961035657664066},
  {"id":"00001_372792","key":["00001","CADENCIER",0],"value":-0.1961035657664066},
  {"id":"00001_386302","key":["00001","CADENCIER",0],"value":0.6934708647727543},
  {"id":"00001_386302","key":["00001","CADENCIER",0],"value":0.6934708647727543},
  {"id":"00001_386963","key":["00001","CADENCIER",0],"value":0.6922628824612621},
  {"id":"00001_386963","key":["00001","CADENCIER",0],"value":0.6922628824612621},
  {"id":"00001_387089","key":["00001","CADENCIER",0],"value":0.6919048724571887},
  {"id":"00001_387089","key":["00001","CADENCIER",0],"value":0.6919048724571887},
  {"id":"00001_387091","key":["00001","CADENCIER",0],"value":0.6919048724571887},
  {"id":"00001_387091","key":["00001","CADENCIER",0],"value":0.6919048724571887},
  {"id":"00001_387099","key":["00001","CADENCIER",0],"value":0.6921140124188077},
  {"id":"00001_387099","key":["00001","CADENCIER",0],"value":0.6921140124188077},
  {"id":"00001_387105","key":["00001","CADENCIER",0],"value":0.6921140124188077},
  {"id":"00001_387105","key":["00001","CADENCIER",0],"value":0.6921140124188077},
  {"id":"00001_387193","key":["00001","CADENCIER",0],"value":0.6936603115840247},
  {"id":"00001_387193","key":["00001","CADENCIER",0],"value":0.6936603115840247},
  {"id":"00001_387848","key":["00001","CADENCIER",1],"value":-0.29332158594360835},
  {"id":"00001_387848","key":["00001","CADENCIER",1],"value":-0.29332158594360835},
  {"id":"00001_388313","key":["00001","CADENCIER",1],"value":-0.0461553701861542},
  {"id":"00001_388313","key":["00001","CADENCIER",1],"value":-0.0461553701861542},
  {"id":"00001_388806","key":["00001","CADENCIER",1],"value":-0.04833054041013961},
  {"id":"00001_388806","key":["00001","CADENCIER",1],"value":-0.04833054041013961},
  {"id":"00001_388897","key":["00001","CADENCIER",1],"value":-0.25761199232338083},
  {"id":"00001_388897","key":["00001","CADENCIER",1],"value":-0.25761199232338083},
  {"id":"00001_435016","key":["00001","CADENCIER",1],"value":-0.037149057843773745},
  {"id":"00001_435016","key":["00001","CADENCIER",1],"value":-0.037149057843773745}
  ...
  ]}
  </code></pre>
  
  <p>I want to reduce to group by key and return the count of values of each key as well as some other calculation on the values.</p>
  
  <p>I did this:</p>
  
  <pre><code>function (key, values, rereduce) {
  
    var result = {};
    var ecartsSum;
    for(var i = 0; i &lt; values.length; i++) {
      ecartsSum =+ values[i];
    }
    result.productsNumber = values.length;
    result.index = 100 + (Math.tan(ecartsSum/values.length)) * 100
    return result;
  }
  </code></pre>
  
  <p>When I request the view using the key <code>["00001","CADENCIER",0]</code></p>
  
  <p>I get this result :</p>
  
  <pre><code>{
    "productsNumber": 3,
    "index": null
  }
  </code></pre>
  
  <p>which is not at all the result I was expecting.</p>
  
  <p>PS: I use these options to select :
      connection_timeout=600000000&amp;full_set=true&amp;group=true&amp;inclusive_end=true&amp;key=%5B%2200001%22,%22CADENCIER%22,0%5D&amp;limit=6&amp;reduce=true&amp;skip=0&amp;stale=false</p>