evently を使用して map と reduce の両方を使用してビューのマップのみをクエリするにはどうすればよいですか?
これまでのところ、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}
};
これにより、クエリからの行の総数とそれらの値の平均が返されます。
助けてくれてありがとう。