Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 59777 invoked from network); 17 Mar 2009 11:00:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Mar 2009 11:00:35 -0000 Received: (qmail 81237 invoked by uid 500); 17 Mar 2009 11:00:32 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 81205 invoked by uid 500); 17 Mar 2009 11:00:31 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 81194 invoked by uid 99); 17 Mar 2009 11:00:31 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Mar 2009 04:00:31 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [83.97.50.139] (HELO jan.prima.de) (83.97.50.139) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Mar 2009 11:00:22 +0000 Received: from [192.168.1.104] (f053005043.adsl.alicedsl.de [::ffff:78.53.5.43]) (AUTH: LOGIN jan, TLS: TLSv1/SSLv3,128bits,AES128-SHA) by jan.prima.de with esmtp; Tue, 17 Mar 2009 10:59:59 +0000 Message-Id: <02E9C69F-7EFA-455B-95A4-F53035041682@apache.org> From: Jan Lehnardt To: user@couchdb.apache.org In-Reply-To: <41139fcb0903170237i19d4330cwc7e0deb278cb16ad@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Subject: Re: equivalent of JOINs in couchdb? Date: Tue, 17 Mar 2009 11:59:57 +0100 References: <41139fcb0903130459td4f3d40ic4f418d7842c14ba@mail.gmail.com> <094453DE-AFFD-4905-A2F3-4A35304BC1FA@apache.org> <41139fcb0903162334x29642057q949366f1c1add446@mail.gmail.com> <7AECE556-1FE7-4F66-8D95-EF5FF294EB17@gmail.com> <41139fcb0903170237i19d4330cwc7e0deb278cb16ad@mail.gmail.com> X-Mailer: Apple Mail (2.930.3) X-Virus-Checked: Checked by ClamAV on apache.org On 17 Mar 2009, at 10:37, Anand Chitipothu wrote: > On Tue, Mar 17, 2009 at 12:38 PM, Wout Mertens > 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 --