incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Hahn <m...@hahnca.com>
Subject Re: Map/reduce problem
Date Mon, 02 Jul 2012 22:26:10 GMT
I personally store dates by standard ms number and take the trouble to
figure out the startkey and endkey.  Standard date functions can easily let
you pick a particular year, mon, day, or any other range.

On Mon, Jul 2, 2012 at 2:12 PM, João Ramos <joao.sigma@gmail.com> wrote :

> Hi,
>
> 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.
>

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