Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 92366 invoked from network); 12 Jan 2009 19:26:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Jan 2009 19:26:11 -0000 Received: (qmail 84406 invoked by uid 500); 12 Jan 2009 19:26:10 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 84369 invoked by uid 500); 12 Jan 2009 19:26:10 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 84358 invoked by uid 99); 12 Jan 2009 19:26:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Jan 2009 11:26:10 -0800 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 jchris@gmail.com designates 74.125.44.29 as permitted sender) Received: from [74.125.44.29] (HELO yx-out-2324.google.com) (74.125.44.29) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Jan 2009 19:26:01 +0000 Received: by yx-out-2324.google.com with SMTP id 3so3244156yxj.5 for ; Mon, 12 Jan 2009 11:25:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=663nuJFGh2cIH7R7ZCBvKLrs++QaydMp8cKuu2gjrDI=; b=QgiEhD72FjIYf+eTwKzoYDeCgqOO7obIVGJQL2/MHV/comzFZbON+W/OSwqIxeplRa wKN4JxM5K3Tx4bFAXpD6hURU5qxLXflOIGBylrd733EX33j+ju5GCKmJNxEgbNmOGWho RXRp3iFseh3z4Eu1nh4tUaCo4CWT3bkILr7nU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=d1OyGw1EPiOOhMXl5wED/F5mnU9YPJ8HoXPAYiNu+rSN30p0MYHCZizJOhJMbe4RrE 92wzQ10o1tzvijLfX325/Mt3nhQDobwKhQeyR+WFukWCq6BehbZV3cgBKnes6PrA9Dvj BzcunHwTPEzkaA4kilUcoFoq85swA17h4tQTg= Received: by 10.65.145.18 with SMTP id x18mr4778253qbn.123.1231788339838; Mon, 12 Jan 2009 11:25:39 -0800 (PST) Received: by 10.64.209.17 with HTTP; Mon, 12 Jan 2009 11:25:39 -0800 (PST) Message-ID: Date: Mon, 12 Jan 2009 11:25:39 -0800 From: "Chris Anderson" To: dev@couchdb.apache.org Subject: =?ISO-8859-1?Q?Re:_=5Fshow_API_(n=E9e_=5Fform)?= In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <64a10fff0901091401k191932b3k1963c2d07d7b2408@mail.gmail.com> <226d73360901120021n2334f477ve8deea2c5f2c456b@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org On Mon, Jan 12, 2009 at 11:09 AM, Paul Davis wrote: > On Mon, Jan 12, 2009 at 2:01 PM, Chris Anderson wrote: >> On Mon, Jan 12, 2009 at 12:21 AM, Ulises wrote: >>>> I see where you're coming from, but I don't like this very much. My >>>> thoughts were something along the lines of being able to have multiple >>>> show functions per view. We could do the repeating the view code but >>>> that's really not good. >>> >>> FWIW, +1 on multiple shows per view. Following the MVC ideology, we >>> could say that the couchdb view is actually the model (the data) and >>> that the couchdb _show is the MVC view (the presentation). It only >>> makes sense (at least to me) to be able to present the same data in >>> many different ways, i.e. XML or JSON. >>> >> >> There's no limit on the ways you can present it, even with a single >> function. You can always switch on the clients Accept header, or on >> query parameters. This is really a question about how to organize the >> urls and the design docs. I do like your point about MVC. >> >> The nice thing about one function per view is that it allows for >> shorter paths, the downside is potentially more complex functions. I >> *think* it's straightforward that we should only allow views to be >> rendered by show functions defined in the same design doc as the view, >> but I could be convinced of the merits otherwise. > > Using show's to process views from other design docs sounds like more > code for the same level of usefulness. Also I think that it might > convey the wrong idea in terms of how to design applications etc. But > I could still be convinced otherwise. > OK lets assume that we don't want to do that (I think it's a bad idea too) So for view showing we'd have something like: A) GET /db/_show_view/mydesign/myview or B) GET /db/_show_view/mydesign/myshowfunc/myview or C) GET /db/_view/mydesign/myview?strartkey="foo"&show=myshowfunc and in the design doc: { ... "show" : { "docs" : { ... }, "views" : { "myshowfunc" : "function(row, head) { ... }" } } In the case with one show function per view, we'd require that "myshowfunc" have the same name as "myview"... I'm leaning toward letting the user decide at query-time which view to render using which show-func, that is, options B or C. -- Chris Anderson http://jchris.mfdz.com