You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Dmitrii Dimandt <dm...@gmail.com> on 2009/03/13 21:03:27 UTC

Relational data

Yeah, I know, I know, relational data was never meant to be in  
CouchDB, but still...

What would be the best way to handle the following situation:

news: url, text
comments: news_url, text, user_login
user: display_name, user_login


So, when I show a news item with comments, it means that I need to do  
a round trip to CouchDB for every comment in order to retrieve the  
user's display name. Is there a better way to do it?

Re: Relational data

Posted by Paul Davis <pa...@gmail.com>.
Dmitrii,

The two recommended ways would either be to store the display_name in
the comment or use multi-get to fetch all user docs at once.

HTH,
Paul Davis

On Fri, Mar 13, 2009 at 4:03 PM, Dmitrii Dimandt <dm...@gmail.com> wrote:
> Yeah, I know, I know, relational data was never meant to be in CouchDB, but
> still...
>
> What would be the best way to handle the following situation:
>
> news: url, text
> comments: news_url, text, user_login
> user: display_name, user_login
>
>
> So, when I show a news item with comments, it means that I need to do a
> round trip to CouchDB for every comment in order to retrieve the user's
> display name. Is there a better way to do it?
>