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 42E6A7FA1 for ; Mon, 24 Oct 2011 07:30:07 +0000 (UTC) Received: (qmail 23480 invoked by uid 500); 24 Oct 2011 07:30:05 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 23378 invoked by uid 500); 24 Oct 2011 07:30:05 -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 23348 invoked by uid 99); 24 Oct 2011 07:30:03 -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 07:30:03 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [209.85.161.180] (HELO mail-gx0-f180.google.com) (209.85.161.180) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Oct 2011 07:29:57 +0000 Received: by ggnv2 with SMTP id v2so8179283ggn.11 for ; Mon, 24 Oct 2011 00:29:35 -0700 (PDT) Received: by 10.68.30.198 with SMTP id u6mr30210970pbh.38.1319441375507; Mon, 24 Oct 2011 00:29:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.46.74 with HTTP; Mon, 24 Oct 2011 00:29:15 -0700 (PDT) From: Jamie Talbot Date: Mon, 24 Oct 2011 17:29:15 +1000 Message-ID: Subject: Inlining Linked Document Data To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org 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