From user-return-5178-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Thu Jun 18 15:48:14 2009 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 63206 invoked from network); 18 Jun 2009 15:48:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Jun 2009 15:48:13 -0000 Received: (qmail 44763 invoked by uid 500); 18 Jun 2009 15:48:23 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 44680 invoked by uid 500); 18 Jun 2009 15:48:23 -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 44669 invoked by uid 99); 18 Jun 2009 15:48:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jun 2009 15:48:23 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [145.58.169.70] (HELO tweehoog.vpro.nl) (145.58.169.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jun 2009 15:48:13 +0000 Received: from digi174.vpro.nl ([145.58.169.174]) by tweehoog.vpro.nl with esmtp (Exim 3.36 #1) id 1MHJqA-0001dZ-00 for user@couchdb.apache.org; Thu, 18 Jun 2009 17:47:50 +0200 Message-ID: <4A3A61A6.9030209@vpro.nl> Date: Thu, 18 Jun 2009 17:47:50 +0200 From: Nils Breunese User-Agent: Thunderbird 2.0.0.21 (X11/20090409) MIME-Version: 1.0 To: "user@couchdb.apache.org" Subject: Re: couchdb and linked data References: <4A365733.10109@iastate.edu> <634e096f0906150757h6de4b6f2jb66764041d404574@mail.gmail.com> <4A36645B.9030000@iastate.edu> <4A3A040E.7090901@vpro.nl> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Benoit Chesneau wrote: > 2009/6/18 Nils Breunese : > >> Yes, being able to write show functions is nice, but you'll have to request >> another URL if you want the document in a non-JSON format, which is not >> really the REST way of doing business. >> >> Of course you can just always request the show function URL, also for JSON >> output, but AFAIK the output of show functions is not prerendered by CouchDB >> (yet?), so performance-wise it might be better to go to the document-URL >> itself directly if you want JSON. Are there any plans to (maybe optionally) >> prerender the output of show functions? Maybe this is even possible for list >> functions if heads, rows and tails are prerendered separately? > > Something like this woudl allow you to follow REST principle : > > function(doc, req) { > return respondWith(req, { > "html": return { body: "somehtml" }, > "json": return { "headers": "Content-Type: application/json", json: doc } > } > } > > > But only for get for now. Yeah, that is what I described and implemented. You'd need "json: return toJSON(doc);" though. I don't think list views can be prerendered, as there are dynamic things like rowcounts that can't be prerendered AFAIK, but our application would benefit from prerendered show views for our documents. Any idea what the overhead of serving JSON via toJSON(doc) in a content negotiation show function is over getting the JSON document directly? Nils Breunese.