couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Moritz Post <>
Subject Included docs in 0.11
Date Wed, 21 Apr 2010 13:08:08 GMT
Hi Couch people

Version 0.11 of CouchDB introduced linked documents (other than the
originating document) in Views. But it seems that the included docs can not
be accessed in lists which use the view:

>>>>> snip - Example from couchdb wiki
Linked documentsFor example, if you have the following hierarchically-linked

{ "_id": "11111" },
{ "_id": "22222", "ancestors": ["11111"], "value": "hello" },
{ "_id": "33333", "ancestors": ["22222","11111"], "value": "world" }


you can emit the values with the ancestor documents adjacent to them in the
view like this:

function(doc) {
  if (doc.value) {
    emit([doc.value, 0], null);
    if (doc.ancestors) {
      for (var i in doc.ancestors) {
        emit([doc.value, Number(i)+1], {_id: doc.ancestors[i]});


The result you get is:

"doc":{"_id":"11111","_rev":"1-967a00dff5e02add41819138abb3284d"}} ]}

<<<<< snip

I would like to use the result of the view in a list, e.g. get

But the getRow() function of the list only retrieves my {_id, "22222" } as
value and not the referenced document. The list can also not access included
documents from views that reference the original document (emit( doc._id,
null)  and use include_docs=true ).

Other view parameters provided to lists are taken into account (key,
startkey, group and so on) as expected.

Any clarification (or workaround) for accessing included_docs in lists would
be very much appreciated.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message