From user-return-4052-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Tue Mar 17 07:05:13 2009 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 42385 invoked from network); 17 Mar 2009 07:05:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Mar 2009 07:05:13 -0000 Received: (qmail 14085 invoked by uid 500); 17 Mar 2009 07:05:12 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 14036 invoked by uid 500); 17 Mar 2009 07:05:12 -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 14025 invoked by uid 99); 17 Mar 2009 07:05:11 -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 00:05:11 -0700 X-ASF-Spam-Status: No, hits=-1.0 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of gcdcu-couchdb-user@m.gmane.org designates 80.91.229.2 as permitted sender) Received: from [80.91.229.2] (HELO ciao.gmane.org) (80.91.229.2) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Mar 2009 07:05:02 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1LjTLs-0004FK-JX for user@couchdb.apache.org; Tue, 17 Mar 2009 07:04:40 +0000 Received: from d66-183-34-208.bchsia.telus.net ([66.183.34.208]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 17 Mar 2009 07:04:40 +0000 Received: from dan_the_man by d66-183-34-208.bchsia.telus.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 17 Mar 2009 07:04:40 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: user@couchdb.apache.org From: Daniel Friesen Subject: Re: equivalent of JOINs in couchdb? Date: Tue, 17 Mar 2009 00:04:23 -0700 Lines: 32 Message-ID: References: <41139fcb0903130459td4f3d40ic4f418d7842c14ba@mail.gmail.com> <094453DE-AFFD-4905-A2F3-4A35304BC1FA@apache.org> <41139fcb0903162334x29642057q949366f1c1add446@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: d66-183-34-208.bchsia.telus.net User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17) Gecko/20080914 Thunderbird/2.0.0.17 ThunderBrowse/3.2.1.9 Mnenhy/0.7.5.666 In-Reply-To: <41139fcb0903162334x29642057q949366f1c1add446@mail.gmail.com> Sender: news X-Virus-Checked: Checked by ClamAV on apache.org Don't take my word completely for it, since I only started looking into CouchDB earlier on today. But I think the issue is understanding the difference in thought process. Rather than querying for data joining that data together, you index data with keys beforehand and use those keys to find the data. For any of this kind of complex data, you create a view that emits keys using the relevant data. So rather than a JOIN which finds all comments by post ids which are found by issue ids. You create a view which emits keys referring to the issue by tracking backwards to find the issue out from the post. Then you can just give it a issue id and it'll list out the comments. ~Daniel Friesen (Dantman, Nadir-Seen-Fire) 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? >