You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Thomas Williams <th...@dubitlimited.com> on 2009/01/10 20:20:08 UTC
View configuration
Hi chaps,I've spent a couple of days playing around with version 0.80 and I
think I might be missing something. Is it possible to configure views at
query time or do they have to always be effectively 'static'. I mean can I
write a view something like this:
function(doc, user_id) {
if(doc.user_id=user_id)
emit(doc)
}
Then pass user_id as a parameter to each query. If not, does anyone know how
I can go about retrieving data based on a unique key in an efficient manner?
Thanks,
Tom
--
Thomas Williams
Java Programmer
Dubit Limited
+44 1133 947920
www.dubitlimited.com
Re: View configuration
Posted by Chris Anderson <jc...@gmail.com>.
On Sat, Jan 10, 2009 at 11:20 AM, Thomas Williams
<th...@dubitlimited.com> wrote:
> Hi chaps,I've spent a couple of days playing around with version 0.80 and I
> think I might be missing something. Is it possible to configure views at
> query time or do they have to always be effectively 'static'. I mean can I
> write a view something like this:
>
> function(doc, user_id) {
> if(doc.user_id=user_id)
> emit(doc)
> }
>
> Then pass user_id as a parameter to each query. If not, does anyone know how
> I can go about retrieving data based on a unique key in an efficient manner?
>
Views must be pure functions from the doc alone (no other data). The
way to build you query is described at
http://wiki.apache.org/couchdb/View_Snippets
--
Chris Anderson
http://jchris.mfdz.com