Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C51D8752D for ; Mon, 24 Oct 2011 08:09:32 +0000 (UTC) Received: (qmail 79133 invoked by uid 500); 24 Oct 2011 08:09:31 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 79006 invoked by uid 500); 24 Oct 2011 08:09:30 -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 78998 invoked by uid 99); 24 Oct 2011 08:09:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Oct 2011 08:09:30 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of alex.barbalex@gmail.com designates 209.85.220.180 as permitted sender) Received: from [209.85.220.180] (HELO mail-vx0-f180.google.com) (209.85.220.180) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Oct 2011 08:09:24 +0000 Received: by vcbfo11 with SMTP id fo11so6866905vcb.11 for ; Mon, 24 Oct 2011 01:09:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=zUPdQXX09mO6aMRdS/3xPBr+JNrRDAbab0aOLWAMXAw=; b=q1fSMDwsxXI9lKHm5hj+n8LRsrvw6bSYFIq0RootNraW1a3w/dQH4x+mSynGJEJ32v HpcDI1fqX5yDS3BshpbRnfjgen2sv67oUCaYGB6KGD07tf0OdYqnie4IVnTaxLf8LWPc zzhtoaDWflkh4XctrF7116KeIsGbunldurOTg= MIME-Version: 1.0 Received: by 10.52.240.132 with SMTP id wa4mr22151593vdc.16.1319443743916; Mon, 24 Oct 2011 01:09:03 -0700 (PDT) Sender: alex.barbalex@gmail.com Received: by 10.52.114.196 with HTTP; Mon, 24 Oct 2011 01:09:03 -0700 (PDT) In-Reply-To: References: Date: Mon, 24 Oct 2011 10:09:03 +0200 X-Google-Sender-Auth: zsH4Dp9ow5skCE8PAe8402hbJzg Message-ID: Subject: Re: Inlining Linked Document Data From: Alexander Gabriel To: user@couchdb.apache.org Content-Type: text/plain; charset=UTF-8 X-Virus-Checked: Checked by ClamAV on apache.org this feature would be extremely useful Alex 2011/10/24, Jamie Talbot : > Hi, > > With reference to linked documents, is there any support for the idea > of linked document data being inlined into an emitted {_id: XXX} > block, perhaps with a new query parameter such as 'follow_links=true', > rather than being appended when called with 'include_docs=true'? > > I know this represents a substantial departure from how things work > now, but it would offer two significant benefits that I can see: > > 1) The ability to follow multiple linked docs from a single document > in a single request. Let's say for a blog post: > > function (doc) { > emit(doc.timestamp, [{_id: doc.category_id}, {_id: doc.user_id}]); > } > > called with follow_links=true which would return for example: > > { > "key": 'POST010', > "value": [{ > '_id': 'CAT001', > 'name': 'First Category' > }, { > '_id': 'USER004', > 'name': 'Monkey Magic', > 'dob': '1981-02-06' > }] > } > > 2) You could combine it with include_docs=true, and be able to > retrieve the source document at the same time. At the moment when > using this, if I want data from the source and the linked doc, I can > only retrieve one or the other with include_docs, which either forces > me to emit more data from the source, increasing the size of the view, > or else avoid using the link and make multiple requests. > > While currently useful for hierarchies, I find the linked docs feature > a little limiting when I want to use it for any other purpose. > > Thoughts? > > Are there any existing ways to achieve the above? > > Cheers, > > Jamie > > --- > http://jamietalbot.com > -- ***************************************************************** Alexander Gabriel Wiesenstrasse 22 8800 Thalwil 079/ 372 51 64 alex@barbalex.ch ww.barbalex.ch