couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Nolan <>
Subject Re: One view per "query"?
Date Fri, 10 Jun 2011 15:27:15 GMT
> 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) {


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

-good luck


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