incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Javier Julio <jjfut...@gmail.com>
Subject Re: Help With map function
Date Wed, 23 Feb 2011 01:52:34 GMT
Andrey,

Great question as I had been struggling with the same. In the docs its kind of buried there
but you can post multiple keys to a view. I believe this is what you are looking for. Correct
me if I'm wrong. So I'd create a view where the index has item, brand and category and then
you can just include a key set for each grouping you want in the post body.

If you look under the table with all the query params in this section of the View docs: http://wiki.apache.org/couchdb/HTTP_view_API#Querying_Options
you'll see a that it mentions you can post multiple keys to a view.

I'm still learning myself so I'm not sure if you can post complex keys (only simple strings
are used). I would assume so since its not stated otherwise but I believe this is what will
solve your problem.

Ciao!
Javi

On Feb 22, 2011, at 8:06 PM, Andrey Cherkashin wrote:

> Hello,
> 
> I have a problem, I can't understand how to write map function that solves my problem:
> 
> I have a lot of "documents", each document has type (e.g. item,  user), category and
brand. So i have map functions that gives me a list of every document that has type item (that's
easy), but how i can get list of all documents that has brand == xxx or category == yyy or
even brand==xxx&category=zzz (xxx,yyy,zzz different every time).


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