couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dean Landolt" <d...@deanlandolt.com>
Subject Re: more newbie questions - how to use more than one key in views
Date Thu, 17 Jul 2008 15:51:18 GMT
> Problem is I need an additional filter in there and I'm not sure how to get
> it in - and it's far from ideal to hardcode the language. Can I have more
> than one key in the emit function? Any examples of this kind of thing
> anywhere?
>

http://www.cmlenz.net/archives/2007/10/couchdb-joins

That should get you started.


>
> I mean, what I really want to do is
>
> "function(doc) { if (doc.type == 'content_node' ) emit((doc.title_slug,
> doc.language, doc.user_id), doc); }"
>
> but somehow I don't think it works like that.


I know, that'd be amazing if it did though, right? Turns out it does, and
it's a huge help in search and sort operations (though it's still taking me
some time to adjust to all the possibilities). From your example, just
change the inside set of () in the emit to [] and you're in business.

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