In my current setup, I have created a view that counts reports for different cities.
function (doc) {
if(doc.type == "report")
{
emit(doc.city_name, null);
}
}
Using the _count
reduce function, I get the following values:
{'key': 'South Tampa', 'value': 2}
{'key': 'Sebring', 'value': 19}
{'key': 'Satsuma', 'value': 3}
{'key': 'Palm Desert', 'value': 1}
{'key': 'Indio', 'value': 1}
Currently, I am making requests to this view with multiple keys (such as ["Indio", "Satsuma"]
) and then summing them in Python.
I'm curious if it is possible to perform the summation directly within CouchDB itself?