couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Lehnardt <...@apache.org>
Subject Re: equivalent of JOINs in couchdb?
Date Tue, 17 Mar 2009 10:59:57 GMT

On 17 Mar 2009, at 10:37, Anand Chitipothu wrote:

> On Tue, Mar 17, 2009 at 12:38 PM, Wout Mertens  
> <wout.mertens@gmail.com> wrote:
>> On Mar 17, 2009, at 7:34 AM, Anand Chitipothu wrote:
>>
>>>> http://www.cmlenz.net/archives/2007/10/couchdb-joins
>>>>
>>>
>>> Thanks. That was a good article.
>>>
>>> For my understanding, let me extend the same example to a magazine
>>> instead of blog.
>>> A magazine will have issues, each issue will have posts and post  
>>> will
>>> have comments.
>>> I can use the technique described in the above blog post to display
>>> comments in each post.
>>>
>>> What if I want to display all comments of all posts of an issue?
>>
>>
>> Something like
>>
>> function(doc) {
>>   if (doc.type == "post") {
>>      map([doc.magazine, doc._id, 1], doc);
>>   } else if (doc.type == "comment") {
>>      map([doc.magazine, doc.post, 2], doc);
>>   }
>> }
>>
>> ? You'd need to duplicate the magazine information on the comments  
>> though.
>
> Is it not possible to achieve that without adding magazine to each  
> comment?

Not really, no. Is it an issue?

Cheers
Jan
--


Mime
View raw message