couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Anderson" <>
Subject Re: Loading another object to return in a view!
Date Sat, 12 Apr 2008 01:25:19 GMT
On Fri, Apr 11, 2008 at 4:46 PM, Guby <> wrote:
> Is there no way for a view, indexing the document
> X, to access the database and get some info?

As Jan said, there's no support in the Javascript view engine for http
queries. This would wreck havoc with view consistency. You can plug in
your own view engine if you really need that functionality. (You could
even run a variant of the Javascript view engine with HTTP support.)

But I doubt you really need to run subqueries. Especially once the
Reduce capability is available, you should be able to accomplish
whatever it is you are thinking of by clever view-key assignment and
reduction. It took me some time to grasp the transforms that can be
accomplished through map/reduce, and I wish I could point to a
resource that lays out the various methods people use to accomplish
particular ends, but I can't think of any. If you keep in mind that
CouchDB's constraints are your friend, you'll find that you may even
come up with a more elegant solution that doesn't involve subqueries
(which would totally break the good properties that CocuhDB does give
you.) Remember that a document can map to multiple view keys, and that
reduce will be fed all view rows that share a given key, and you'll
likely come up with away to accomplish what you are looking for.


Chris Anderson

View raw message