couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From João Ramos <>
Subject Map/reduce problem
Date Mon, 02 Jul 2012 21:12:42 GMT

I have a map function that emits these keys:
    [doc.type, 2012, 2, 14]
    [doc.type, 2012, 2, 14]
    [doc.type, 2012, 4, 22]
    [doc.type, 2012, 5, 23]

This works great because I can get exactly what I want (ajusting the
group_level accordingly): for each doc type, how many exist each day, or
each month, each year or just by doc type.

Now my problem is that I also want to filter by date, for example: between
two dates, for each doc type, how many exist for each day, month or year?
Since startkey / endkey cannot have empty keys on the left (in order to
ignore the doc type and just filter by date), how can I do this?

If my keys where in the form of [2012, 2, 14, doc.type], I would be able to
filter properly by date, but then, for each day, I would have to manually
accumulate for each doc type (and the list has several years).

Is what I'm asking even possible?
Thank you.

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