Use view collation to gather details:
function(doc) {
if (doc.type == "post") {
emit([doc._id, 0], doc);
} else if (doc.type == "comment") {
emit([doc.post_id, 1], doc);
}
}
and query with ?key=<post_id>
Pergunta
Is there a way in CouchDB to make a master/detail _view or _list?
From the other hand it looks like _view is only able to render a master and _list is only able to render a list of detail. So the answer could be proofed by a link that confirms that it is impossible.
Solução
Use view collation to gather details:
function(doc) {
if (doc.type == "post") {
emit([doc._id, 0], doc);
} else if (doc.type == "comment") {
emit([doc.post_id, 1], doc);
}
}
and query with ?key=<post_id>