2
如何仅使用地图查询视图的地图,如何使用evently查询减少?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}
};
我想这是从查询和值的平均值返回的行总数。
在此先感谢您的帮助。