couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torstein Krause Johansen <torsteinkrausew...@gmail.com>
Subject Re: Complex queries & results
Date Fri, 27 May 2011 03:11:06 GMT
Hi all,

thanks for the great feedback.

On 26/05/11 19:26, Sean Copenhaver wrote:
> Have you tried having a map function that emits the 'a_name' as a key then a
> reduce function that uses the builtin sum(), then you query with group=true?

If I do:

emit([a_name, one_id, another_id, created_at]);

I can query it with (reduce just being the built in _count)

group=true&group_level=1

and by that get the dictionary I wanted:

{
  "Lisa" : 1
  "John" : 3
}

I know need to make the start and endkey parameters ignore the first 
element of my key as a_name is not a search parameter. I've tried with 
this search for one_id=1, another_id=2 and date between 2011-05-26 and 
2011-05-27:

startkey=[{},1,2,"2011-05-26"]&endkey=[{},1,2,"2011-05-27"]

But don't get anything returned. Am I doing this wrong? Is there a 
different way to make the view ignore the first element of the key? In 
the coucdb.log I can see that my query parameters enter Couch the way I 
intended (no BASH escaping going astray).

Cheers,

-Torstein


Mime
View raw message