Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 44118 invoked from network); 17 Mar 2009 07:09:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Mar 2009 07:09:19 -0000 Received: (qmail 16156 invoked by uid 500); 17 Mar 2009 07:09:18 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 16113 invoked by uid 500); 17 Mar 2009 07:09:18 -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 16102 invoked by uid 99); 17 Mar 2009 07:09:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Mar 2009 00:09:18 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of wout.mertens@gmail.com designates 74.125.78.24 as permitted sender) Received: from [74.125.78.24] (HELO ey-out-2122.google.com) (74.125.78.24) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Mar 2009 07:09:07 +0000 Received: by ey-out-2122.google.com with SMTP id 25so12025eya.29 for ; Tue, 17 Mar 2009 00:08:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=vHoaYwWIhN65mYFaBCQUOcAsYJvdmMV5YxqmICEfng4=; b=WBXt1duo3tkBwe5Nnyo99ld+b3i1g0Ua+tRJJ9BhU5Zfzn6/IxSawg9Jhwcjw+lo4T S2NoMY226zHi659jaK5gbMjfB6WSrpnajUChsTglknxsLKYTvIdzdxTzrFtSozQaWjNX epFrfGOFgD7GER5Zz+ABZI0+ppALtneCVRPek= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=cwCcpL3rw9LI2V/905Kbwz9ZdZwkvM8VNcnW4vfTldfR8t/rYTqSuRzctsnZhNBqwq bg3KXqn3dwUkbzEgjE5cs3yB929aqfbsBkl5bkT6MEUwvKwFYUjn9pGjre4LDiUFqyWH 4izXfP06iXl/BO5yzpxUAK/0pC7qfSINQjZ2o= Received: by 10.216.18.205 with SMTP id l55mr2072715wel.194.1237273727438; Tue, 17 Mar 2009 00:08:47 -0700 (PDT) Received: from ?192.168.0.21? (129.49-240-81.adsl-dyn.isp.belgacom.be [81.240.49.129]) by mx.google.com with ESMTPS id f6sm873588nfh.0.2009.03.17.00.08.44 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 17 Mar 2009 00:08:46 -0700 (PDT) Message-Id: <7AECE556-1FE7-4F66-8D95-EF5FF294EB17@gmail.com> From: Wout Mertens To: user@couchdb.apache.org In-Reply-To: <41139fcb0903162334x29642057q949366f1c1add446@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 08:08:42 +0100 References: <41139fcb0903130459td4f3d40ic4f418d7842c14ba@mail.gmail.com> <094453DE-AFFD-4905-A2F3-4A35304BC1FA@apache.org> <41139fcb0903162334x29642057q949366f1c1add446@mail.gmail.com> X-Mailer: Apple Mail (2.930.3) X-Virus-Checked: Checked by ClamAV on apache.org 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. Wout.