> Thanks Aurélien for a better explanation of my problem :-)

Good to hear :)

For the additional computation step, you can:

1. switch to CloudAnt's BigCouch to get chained mapreduce
    http://examples.cloudant.com/sales/_design/sales/index.html

2. or wait for BigCouch integration into Apache CouchDB (in version 2.0)
    https://issues.apache.org/jira/browse/COUCHDB/fixforversion/12315572

3.  or "cheat" and do it with a list.


Regards,

Aurélien


>>>> I need to filter by date and group by group...
>>> You can use the second with group_level=1 and get all the groups at the
>> same time. And you can use _count
>> 
>> 
>> I'm afraid this is not so easy...
>> Using a filter by date will also *group* by date.
>> 
>> Let's take a very simple example...
>> 
>> Here are keys emitted by a map:
>> [2012, 'A']
>> [2012, 'B']
>> [2012, 'C']
>> [2013, 'A']
>> [2013, 'A']
>> [2013, 'A']
>> [2013, 'C']
>> [2014, 'A']
>> [2014, 'A']
>> [2014, 'B']
>> 
>> If we query it with `_count` as the reduce function, `group=true`,
>> `startkey=[2013]` and `endkey=[2014,{}]`, we'll get:
>> [2013, 'A'] -> 3
>> [2013, 'C'] -> 1
>> [2014, 'A']      -> 2
>> [2014, 'B'] -> 1
>> 
>> Boaz will need additional computation to get:
>> 'A' -> 5
>> 'B' -> 1
>> 'C' -> 1
>> 
>> 
>> Regards,
>> 
>> Aurélien

Reply via email to