incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "paul jobs" <webjog...@gmail.com>
Subject clustering based on 2 columns
Date Sun, 21 Dec 2008 22:49:22 GMT
*Hope this query is useful to more people who are using couchdb to collect
stats for their web-apps


Map1 collates based on date map2 collates based on name of application
map3 is not quite what i want,
I want to do what map2 does but only for say "2008-12-21" ie today
how do i get today's statistics?
Thanks a lot

map1*:function(doc) { emit(doc.date, doc.count); }
*reduce*:function(keys, values) { return sum(values)}
*"2008-12-20"*17854*"2008-12-21"*102243

*map2*:function(doc) {
emit(doc.appname, doc.count); }*reduce*:function(keys, values) { return
sum(values)}
Key
Value*"animgifts"*92261*"anoninbox"*98*"areucute"*971*"bdayecards"*13532*
"crushometer"*249*"datevalentine"*766*"igarden"*19*"luvgifts"*143*
"newstickers"*561*"ownmenow"*74

*map3*:function(doc) {
emit([doc.appname,doc.date], doc.count); }
*reduce*:function(keys, values) { return sum(values)}

*["animgifts", "2008-12-20"]*10420*["animgifts",
"2008-12-21"]*81871*["anoninbox",
"2008-12-20"]*67*["anoninbox", "2008-12-21"]*31*["areucute", "2008-12-20"]*
434*["areucute", "2008-12-21"]*537*["bdayecards",
"2008-12-20"]*3175*["bdayecards",
"2008-12-21"]*10390*["crushometer", "2008-12-20"]*69*["crushometer",
"2008-12-21"]*180

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message