You need a more complex view processor, I think. One that can make additional requests during view processing.
On Fri, Dec 12, 2008 at 11:12 AM, Adam Wolff <[email protected]> wrote: > Hi everyone, > I'm just getting started with CouchDB and I'm really excited about it. I'm > working with a directed acyclic graph, and I'd like to be able to > efficiently > retrieve graph chunks with a single query. > > So conceptually, my data looks like this > > doc1: {content: ..., ancestor: null} > doc2: {content: ..., ancestor: "doc1"} > doc3: {content: ..., ancestor: "doc2"} > doc4: {content: ..., ancestor: "doc3"} > doc5: {content: ..., ancestor: "doc3"} > > > Long runs of singly linked ancestors will be common; branches (e.g. after > doc3 > in the example above) will be less common but not rare. > > I get how you can use couch to retrieve a primary key and foreign key at > the > same time (through view collation) but I'm wondering if there's a clever > way > to > do this recursively. > > If I could pull depths of 5 nodes or so at a time, that'd be fine. I can > always > go back for more if I need it. I can imagine a few hacky solutions, like > retaining a list of ancestors, but that it makes it pretty much impossible > to > reorder the graph. > > Is there a clever solution I'm missing? > > Thanks in advance, > A >
