couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Alfke <>
Subject Re: Passing permanent changing arguments to a view?
Date Wed, 19 Feb 2014 04:50:45 GMT

On Feb 18, 2014, at 4:24 PM, Ben Skarsgård <> wrote:

> Is there a possibility to pass some arguments to a view?

Keith already answered the main point of your post, but in answer to this question — this
is a pretty frequent misunderstanding about views. (I actually answered an identical question
on another mailing list this morning!)

The best way to think of it is that **a view is an index.** That is, defining a view is a
lot like executing a CREATE INDEX statement in SQL, you just get more flexibility over the
'columns' and the generated keys. If you look at it this way, it clearly doesn't make any
sense to pass arguments to an index: it's a structure that gets built once and then updated
only as the data changes.

If you want to query different things, you don't tear down the index and build a different
one, you just alter the parameters of your query over the same index. In CouchDB those parameters
are the startkey and endkey, limit, offset, etc.

View raw message