You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by Paul Davis <pa...@gmail.com> on 2008/08/17 03:41:00 UTC
Include_docs patch is up
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.
Re: Include_docs patch is up
Posted by Chris Anderson <jc...@grabb.it>.
On Sat, Aug 16, 2008 at 6:41 PM, Paul Davis <pa...@gmail.com> wrote:
> I've pushed an include_docs patch to github:
> http://github.com/davisp/couchdb/tree/multiget
>
> 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
>
Paul,
This is awesome to see. The tests are all passing on my machine now.
> 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.
>
I like the idea of emitting the _rev, there's probably a lot of things
you can use that for.
It's gonna be fun to refactor my app to use multi-key and see how much
more quickly it runs.
Chris
--
Chris Anderson
http://jchris.mfdz.com