2
어떻게 맵을 사용하여 뷰의 맵을 쿼리하고 이벤트를 사용하여 줄일 수 있습니까? 여기couchdb 쿼리 맵보기 및 뷰 축소 없음
내가 data.js 지금까지 무엇을 가지고 :
function(data) {
var numRows = data.rows.map(function(r) {
return r
}); //this is returning an object that is the result of the reduce function
// but I want the total_rows of the map function
var sum = data.rows.reduce(function(r) {
return r.value
}); //this returns the sum of all row values
var avg = sum.value/numRows
$.log(avg);
$.log(numRows);
return {'total': numRows, 'average': avg}
};
내가이 쿼리와 값의 평균에서 행의 총 수를 반환합니다.
도움을 미리 감사드립니다.