From couchdb-user-return-1773-apmail-incubator-couchdb-user-archive=incubator.apache.org@incubator.apache.org Tue Nov 11 20:33:19 2008 Return-Path: Delivered-To: apmail-incubator-couchdb-user-archive@locus.apache.org Received: (qmail 15331 invoked from network); 11 Nov 2008 20:33:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Nov 2008 20:33:19 -0000 Received: (qmail 25507 invoked by uid 500); 11 Nov 2008 20:33:26 -0000 Delivered-To: apmail-incubator-couchdb-user-archive@incubator.apache.org Received: (qmail 25461 invoked by uid 500); 11 Nov 2008 20:33:26 -0000 Mailing-List: contact couchdb-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: couchdb-user@incubator.apache.org Delivered-To: mailing list couchdb-user@incubator.apache.org Received: (qmail 25442 invoked by uid 99); 11 Nov 2008 20:33:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Nov 2008 12:33:25 -0800 X-ASF-Spam-Status: No, hits=3.2 required=10.0 tests=HTML_MESSAGE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [74.125.46.155] (HELO yw-out-1718.google.com) (74.125.46.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Nov 2008 20:32:07 +0000 Received: by yw-out-1718.google.com with SMTP id 5so46176ywr.0 for ; Tue, 11 Nov 2008 12:32:40 -0800 (PST) Received: by 10.90.33.5 with SMTP id g5mr7607855agg.97.1226435559979; Tue, 11 Nov 2008 12:32:39 -0800 (PST) Received: by 10.90.90.17 with HTTP; Tue, 11 Nov 2008 12:32:39 -0800 (PST) Message-ID: <64a10fff0811111232n4faea74er7131664c572274c1@mail.gmail.com> Date: Tue, 11 Nov 2008 15:32:39 -0500 From: "Dean Landolt" To: couchdb-user@incubator.apache.org Subject: Re: joins, reprise In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_115464_26853724.1226435559966" References: <64a10fff0811111157u81720d8t52cd4bb36073548e@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_115464_26853724.1226435559966 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Tue, Nov 11, 2008 at 3:08 PM, Paul Davis wrote: > I think this is an interesting idea, and has mostly been done with > client libraries. ATM, I'm leaning towards saying that this is a > client extension and doesn't really belong in couch. There are a crap > load of optimizations that clients could make that couch couldn't. > > I have some ideas running around in my head about doing object graph > loading etc. Things really start to get fun on the client when you > contemplate referencing other databases etc. > > Anyway, if you can come up with some part of this functionality that > *must* be done server side and has a big enough use case, ideas for > patches are always welcome :D I didn't think of it that way, but I agree. Perhaps a querytools plugin would be in order when the plugin system lands, but this is probably best left to the client. Does anybody know if jquery.couch does something like this? If not, I'll have a go at hacking it in. > > > Paul > > > On Tue, Nov 11, 2008 at 2:57 PM, Dean Landolt > wrote: > > I know this join discussion has come up again and again, and with > multi-key > > get it's really not that hard to do a join in two steps. But I was > playing > > with include_docs and it got me thinking -- couldn't there be a > dereference > > parameter on views that acted like include docs? So you could pass in > > ?dereference=tags, for instance, and in the return the view could grab > all > > tag attributes and dereference them if their value is a string containing > an > > existing _id. This would be a *real* join, all without any complicated > > accounting -- and it would put an end to the whole *but sql can do > this*... > > whining. > > > > Bonus points for being able to pass in a list of dereference attributes > > (?dereference=[tags,comments] or ?dereference=tags&dereference=comments) > and > > even better, if the given attribute's value is a list, iterating over it > and > > dereferencing any string containing an existing _id. This would be far > nicer > > than sql joins -- you would essentially get real many-to-manies sans > > join-table awkwardness. > > > > Does this seem logical? Doable? > > > ------=_Part_115464_26853724.1226435559966--