I've pushed an include_docs patch to github:
http://github.com/davisp/couchdb/tree/multiget
Tarball download:
http://github.com/davisp/couchdb/tarball/multiget
Let me know if you use it and find broken stuff. I'm pretty sure I've
got the most common use cases covered by unit tests, but due to poor
brain performance at this hour its likely that I missed corner cases.
I'd type more but my hands are cold and not working so well. So
instead, you get a cut and paste of the commit message. Thanks for
playing.
Code and tests for include_docs.
"include_docs" will return the set of documents referred to in a
view. It does this by adding a "docs" attribute to the returned
json object. To acceess include_docs functionality, merely point your
browser at a map view with the query string parameter ?include_docs=true
include_docs does not work with reduced views as there is no doc_id
associated with the output of reduce.
A nifty feature implemented as per suggestion of Damien Katz is that if
the emitted value has a "_rev" attribute, the corresponding
document is returned (instead of a possibly more current version). This is
to help minimize the possible effects of a race condition that exists.
The race condition is basically caused by the fact that between the time
we read the view and the time when we access the documents on disk, a
modification may have occurred (the RUD of CRUD). So its possible that the
docs don't necessarily match the view results. In order to alleviate this
you can emit the "_rev" attribute so that no matter what the
revision specified in the view is returned. Although there is a second
caveat in that if a document is modified between reading the view and
reading from disk and then compact removes the doc from the database, a
{"_id": id, "error": "missing"} object is
returned.