couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Anderson <>
Subject Re: svn commit: r815984 - in /couchdb/trunk: share/www/script/test/view_include_docs.js src/couchdb/couch_httpd_db.erl src/couchdb/couch_httpd_view.erl
Date Wed, 16 Sep 2009 22:42:10 GMT
On Wed, Sep 16, 2009 at 3:04 PM,  <> wrote:
> Author: jchris
> Date: Wed Sep 16 22:04:18 2009
> New Revision: 815984
> URL:
> Log:
> include_docs now take an _id (as well as a _rev) in the emitted value, to load docs other
than the one doing the emitting. This means you can have one doc list a set of other docs
to load in a single query. Enjoy!

In Governator voice: "It's not a JOIN."

But you can use it if you have a doc like:


and then a view like

function(doc) {
for (var i=0; i < doc.other_docs.length; i++) {
  emit([doc._id, i], {"_id" : doc.other_docs[i]}

and then you will have an ordered list of the other docs available in
a view query (with include_docs) You can also specify the other docs
_rev if you want -- if it's not available it comes up as null in the

Of course, the usual include_docs performance caveats apply, but this
time we get a feature out of it!


Chris Anderson

View raw message