Javi,

Thanks for answer. As far as i know i can use complex keys (according to couch 
wiki) my problem was that I didn't understand how to do it. Now my problem is 
that i can't find way to do "curl 
http://127.0.0.1:5984/hanh-phuc-sac-dev/_design/staff/_view/all?key=\"cat1\"; 
from my ruby app. I'm planing to use couchrest_model and if i understand 
coretly when i add "view_by :category" to my class I can use 
Item.find_by_category('cat1').
On Feb 22, 2011, at 5:52 PM, Javier Julio wrote:

> 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).
> 

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to