couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Wolff" <>
Subject DAG on couch
Date Fri, 12 Dec 2008 16:12:51 GMT
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
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
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
do this recursively.

If I could pull depths of 5 nodes or so at a time, that'd be fine. I can
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
reorder the graph.

Is there a clever solution I'm missing?

Thanks in advance,

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