couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Thomas <herr.alexander.tho...@googlemail.com>
Subject How can I resolve an external relation in embedded documents
Date Fri, 09 Jul 2010 10:53:03 GMT
Hello everybody,

my name is Alexander Thomas. I'm a freelance web developer from Vienna, Austria.

After playing around with CouchDb a bit I finally decided to give it a try in a first real
life project. So in case my question is trivial, don't hesitate to RTFM me and give me a (helpful)
pointer.

I have a document type called 'story'. A story can have multiple sections as embedded documents,
stored in an array.

{
   "_id": "story_14c2f7f84c9701",
   "_rev": "4-abf15eac70a379c9a60b889c9e73357e",
   "type": "story",
   "title": "Untitled",
   "modified": "2010-07-03 20:27:35",
   "sections": [
       {
           "text": "test 1",
           "author_id": id_of_author
       },
       {
           "text": "test 2",
           "author_id": id_of_author
       }
   ]
}

Each section may have a different author so I store authors in different documents to avoid
duplicates.


Reading the available documentation I was able to connect the story itself to an author but
what I would like to have is a view, which collects one / all stories + the information of
the author for each embedded section.

Thank you in advance.

Regards,
Alex
Mime
View raw message