couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aurélien Bénel <aurelien.be...@utt.fr>
Subject Re: Help with reduce function
Date Sat, 06 Oct 2012 19:01:16 GMT
Hi Carl,

Try always to do more with your index. This is indeed where the power of Map/Reduce lies.

map:
function(o) {
   emit([o.date, o.country], null);
}

reduce:
_count

Then query it with group=true.


Regards,

Aurélien

P.S. If you did put "date" after "country", and if date were written as an array, you could
choose the time slot at query time (year or month, day, hour, etc.) by changing the "group_level".
 
Mime
View raw message