couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniele Testa <daniele.te...@gmail.com>
Subject Re: One view per "query"?
Date Fri, 10 Jun 2011 15:31:19 GMT
Ok, I will try some different things and see how it goes :)

No, the music thing was just an example. I am working on something
completely different.

Regards,
Daniele


2011/6/10 Peter Nolan <peterwnolan@gmail.com>:
>>
>> in regards to '10 million documents'
>>
>
>
>
>> not necessarily.  Say you want to find a doc whose field of 'artist' is
>> 'dylan'
>>
>
> you can create a view called byArtist whose code looks like the following.
>
> function (doc) {
>
>     if (doc.artist) {
>         emit(doc.artist,otherStuffYouWantToKnow)
>     }
>
> }
>
> then you can query this view with startKey='dylan' and endKey='dylan'
> and receive those docs that only have the field of artist set to 'dylan'.
>  then you can do some kind of filtering on the client side.
>
> yes, you'll have to do a little copypasta for each field you're interested
> in querying on.
>
> Again, if you have more complicated search algorithms (like regexps and
> whatnot) check out the filter functions from the changes feed.
>
> out of curiosity, what kind of project are you working?  Cause i did a
> little music app myself and would love to see code if you're willing to
> share.
>
> -good luck
>
> -Pete
>

Mime
View raw message