From user-return-21044-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Thu May 31 20:08:12 2012 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 0B2F09F8D for ; Thu, 31 May 2012 20:08:12 +0000 (UTC) Received: (qmail 48851 invoked by uid 500); 31 May 2012 20:08:10 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 48801 invoked by uid 500); 31 May 2012 20:08:10 -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 48791 invoked by uid 99); 31 May 2012 20:08:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 May 2012 20:08:10 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of dave@muse.net.nz designates 209.85.213.52 as permitted sender) Received: from [209.85.213.52] (HELO mail-yw0-f52.google.com) (209.85.213.52) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 May 2012 20:08:05 +0000 Received: by yhpp61 with SMTP id p61so1215859yhp.11 for ; Thu, 31 May 2012 13:07:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=muse.net.nz; s=google; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=sVKazpebhAWBM3XKHsOggTxzKJgiKfqLIZMY+AVDN2s=; b=fcDmVE5jxOGqeqoQjLVzoO3b/AS+fzmK9jkTfxOT9v/1iIBKMzpxQ0w5DqCOQLowIu xJZExyOtlub9ZMFODZlR7ztIQXc4BWu+anGtbvlcqyc/li6zieTuZ2Q5mHXJQ49v2Dav XexHJasVlfN0/9XQd7yv5PExf8qOfQRCLalyw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:content-type:x-gm-message-state; bh=sVKazpebhAWBM3XKHsOggTxzKJgiKfqLIZMY+AVDN2s=; b=QdojUnm7OcADPnDH6+6m6JDW5l8g1DKkihl3oxocmkWnPUjRfWg49H2prPWfplhORo ltsWvEfdCbDL6tqyLAONDOGeiEv2AdfMiJsgroKRnOvI3BwlCoJyDwR+Fj1DnzAIr+jc 0rEzL/2CCCaXZRoglCV6Qcrkdw4WKEyRGo/XBcMCxncV8rQJrukD166Yj7DS5wEbA/E/ YDmcD75wb5BYbXfdF7FhoWc8LsimzRuXGl5lCXuUS2JNh+Cuf+sK+RrOjefLAAC7/XY9 sueUNrHR2+0ucLNWjtW7+yD6ltlauqELD2GHSqs1gWzLEaF/SyrLibi7kE7yVXk6LCV+ Nj0w== MIME-Version: 1.0 Received: by 10.101.106.12 with SMTP id i12mr6783anm.35.1338494864113; Thu, 31 May 2012 13:07:44 -0700 (PDT) Received: by 10.236.182.9 with HTTP; Thu, 31 May 2012 13:07:44 -0700 (PDT) X-Originating-IP: [84.112.19.176] In-Reply-To: <4FC7A0A6.6040704@bardubitzki.com> References: <4FC7975A.2090301@bardubitzki.com> <430BECAAC8F943B08B2FA48591EC820B@cloudant.com> <4FC79A35.7090304@bardubitzki.com> <4FC7A0A6.6040704@bardubitzki.com> Date: Thu, 31 May 2012 22:07:44 +0200 Message-ID: Subject: Re: How to get the doc From: Dave Cottlehuber To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQmLm0V+s93UuotTmlcQ6kxUj5at6RD2GiFO8JcFejzOJd7e0Qr1yyxDT7Q6cMfYryND9wyL X-Virus-Checked: Checked by ClamAV on apache.org On 31 May 2012 18:47, Stephan Bardubitzki wrote: > Thanks Simon, much appreciated. > > Cheers, > Stephan > > > > On 12-05-31 09:32 AM, Simon Metson wrote: >> >> I think in general you want to avoid emitting the doc body (for each view >> that you do this you'll increase your database size by the size of your >> documents). I vaguely recall someone saying it's faster to have the doc body >> in the view (because there's one look up instead of two) but I've not >> noticed it to be a problematic difference, and any non-trivial database is >> going to be large enough to not want to include the doc body IMHO. >> Cheers >> Simon >> >> >> On Thursday, 31 May 2012 at 17:20, Stephan Bardubitzki wrote: >> >>> Thanks, missed that. Would be this the best way to go in any case? Or >>> are there scenarios where emitting doc is more appropriate? >>> >>> On 12-05-31 09:12 AM, Simon Metson wrote: >>>> >>>> Query the view with ?include_docs=true >>>> http://wiki.apache.org/couchdb/HTTP_view_API#Querying_Options >>>> >>>> >>>> On Thursday, 31 May 2012 at 17:07, Stephan Bardubitzki wrote: >>>> >>>>> Somewhere I read that emitting doc._id and doc is a waste of resources >>>>> and that they come for free. >>>>> >>>>> I know that doc._id comes for free, but how do I get the doc for >>>>> example >>>>> in this case: >>>>> >>>>> emit(doc.name (http://doc.name), null) >>>>> >>>>> Thanks. >>>>> Stephan >>>>> >>>> >>>> >>>> -------------------------------- >>>> Spam/Virus scanning by CanIt Pro >>>> >>>> For more information see >>>> http://www.kgbinternet.com/SpamFilter.htm >>>> >>>> To control your spam filter, log in at >>>> http://filter.kgbinternet.com >>>> >>> >>> >> >> >> -------------------------------- >> Spam/Virus scanning by CanIt Pro >> >> For more information see >> http://www.kgbinternet.com/SpamFilter.htm >> >> To control your spam filter, log in at >> http://filter.kgbinternet.com >> > The key thing here is to remember that views are stored in a separate file on disk. So when you emit(... ,doc) it is stashed in the view file. ?include_docs requires reading then from 2 files, the view + the original .couch db file. A+ Dave