You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Clemens Cap <ca...@unagon.com> on 2010/03/25 00:13:22 UTC

Data mapping

Hi,

I hope there is a nice solution for this issue which I do not see (as
CouchDB newbie, who is getting more and more Couch addicted).

I have documents which may content text and/or references to other
documents. The client thus accesses an arbitrary document object, checks
the references made to other document objects (whicha re to be included)
and makes a second trip to the DB to get the refered documents (which
again refer to documents, so we might have a third trip etc.)

Now I would like to get all the documents in ONE call to the DB, since
every trip to the DB means another http call and takes time.

Actually it is kind-of a part explosion problem which I am having here.
(If it helps, I could also provide a maximum nesting depth as part of
the query).

I tried a number of designs with map/reduce but failed. The tricky part
is, that it is the document which knows the documents it contains (and
not vice versa) - AND that the relation is not a tree, but a document
might be referred to by a number of "parent" documents. Thus, storing
the referred documents as part of the parent document is no option.

Any ideas here ?

Best regards and many thanx
Clemens

PS: I am currently having 1 sec. latency from a xmlhttprequest until
even the most trivial results arrives. Since browser and couch are
running on the same high performance quad core I am also a bit
astonished that this is so much. Any ideas on this would also be great.
This is on couch 0.10, Windows XP 64bit, Firefox 3.5, Apache 2.0 Xampp
sitting in between as proxy for same-origin reasons.