Hi ermouth,

> Querying this view with include_docs=true will deliver body of a dependency
> of type "enumeral" instead of parent doc of type "issue".ual docs when it
> runs.

Yes, but as you said and the docs mention I think the issue here is that 
"CouchDB will fetch the document with id XXX rather than the document which was 
processed to emit the key/value pair."

So, we just got the linked document.
If I understand it correctly we have to call emit twice In order to also get 
the parent document, e.g.

views:{foo:{
  map: function(doc){
    if (doc.type == 'issue') {
      emit (doc._id, null); // emit parent document
      if(doc.status) {
          emit (doc._id, {_id: doc.status._id}); // this emits dependency doc
      }
    }
  }
}

Doing this we can fetch both documents with a single request.
But the response is an array of documents which still needs to be 
grouped/formatted at application level.

>There also exists another method, more limited and tricky but sometimes
>more fast...

Wow, this sounds complicated.
I need to dive into it in order to understand it.


> Also there is another method employing _list function...

"List functions are deprecated in CouchDB 3.0, and will be removed in CouchDB 
4.0."
Seems to me that it isn't a good idea to rely on this ;-)

However, many thanks for your suggestions and detailed answer!!

Olaf


Reply via email to