couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul J. Davis" <paul.joseph.da...@gmail.com>
Subject Re: Help With map function
Date Wed, 23 Feb 2011 02:01:02 GMT
Yep, the multi-key post doesn't require string keys.

Also, when you want wild card behavior you need a view that has the non-wildcard selection
criteria as a leading prefix. It's easiest to think about in terms of array slicing.

For the OP I would suggest multiple views with the required array orders for the expected
queries.  

On Feb 22, 2011, at 8:52 PM, Javier Julio <jjfutbol@gmail.com> 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).
> 

Mime
View raw message