couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Anderson" <jch...@grabb.it>
Subject Re: Optionally including docs in view results
Date Mon, 04 Aug 2008 18:57:15 GMT
On Mon, Aug 4, 2008 at 11:40 AM, Chris Anderson <jchris@grabb.it> wrote:
> On Mon, Aug 4, 2008 at 11:31 AM, Tom Wright <tom@inflatablecookie.com> wrote:
>>
>> Is there a way (or is a way planned) for the documents to be optionally
>> attached to a view's result rows via a query string argument?
>
> We were just discussing this on IRC the other day. It should be a
> relatively simple patch to make.

I thought about this some more, and even started writing some tests
for it. Now I'm pretty convinced that this is not the way to go.

Because map functions can emit() many times per document, you'd often
end up transferring much more data than you need to - if a document
maps to 5 keys in your key range you'll get the same document over the
wire 5 times.

The better course of action would be to use the (non-existent)
_load_docs API to load multiple documents. Then you'd do 2 requests
from PHP - one to load the view results, and one to request the
(unique) set of documents associated with the view rows.

-- 
Chris Anderson
http://jchris.mfdz.com

Mime
View raw message