Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 6073 invoked from network); 15 Jul 2009 13:39:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 15 Jul 2009 13:39:02 -0000 Received: (qmail 77451 invoked by uid 500); 15 Jul 2009 13:39:11 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 77399 invoked by uid 500); 15 Jul 2009 13:39: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 77389 invoked by uid 99); 15 Jul 2009 13:39:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Jul 2009 13:39:10 +0000 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 truemped@googlemail.com designates 209.85.218.225 as permitted sender) Received: from [209.85.218.225] (HELO mail-bw0-f225.google.com) (209.85.218.225) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Jul 2009 13:38:58 +0000 Received: by bwz25 with SMTP id 25so1104741bwz.11 for ; Wed, 15 Jul 2009 06:38:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:received:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=TT4nPtkeQ8/RsvTDJT+akYxQMKGlUgkkxvMG0xJsrbo=; b=lu1VdKjaFMTPaDcaKKGAum7apHCeY6QwwAEAQWOwSfc94Ubt+u3iuExHgchFdmeHMD RdYL/ipN8O6YpB6knSLf4NgxuRgng5BN3rE534rXIOHSOoN4IKXyIj4HPCajC6xBago0 dLfzVfsWHxWWCYppb6xJK4+M2uB+aTnEoLBZY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=ay7zlXi14sufHFFEVCE667p9L9/jh1tx5mjrjoY3sXjfnJ5BG7jJ5Tc/fcwFJeXcDR SdQR4lkmk9h4BTNOAkAXH/bDrid3AJQno1ZFMKJbqoLC8+d7fwsCTx8+/jGcJSQ073rC INDimQGbjv+sbcgdrLm/ppuv6IYwTozkEw5nY= Received: by 10.204.118.207 with SMTP id w15mr7644609bkq.97.1247665118322; Wed, 15 Jul 2009 06:38:38 -0700 (PDT) Received: from hence22.org ([85.131.190.91]) by mx.google.com with ESMTPS id 9sm10823121bwz.3.2009.07.15.06.38.37 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 15 Jul 2009 06:38:37 -0700 (PDT) Received: from vandusen.neofonie.priv (crt-01-tr.neofonie.de [81.17.210.28]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by hence22.org (Postfix) with ESMTPSA id 9A05B3E478 for ; Wed, 15 Jul 2009 15:38:34 +0200 (CEST) Message-Id: <5E9C437D-8E17-421E-85CB-3FC87DD90A8B@googlemail.com> From: =?ISO-8859-1?Q?Daniel_Tr=FCmper?= To: user@couchdb.apache.org In-Reply-To: <4A5DD765.60809@gmail.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v935.3) Subject: Re: Updating views while inserting documents Date: Wed, 15 Jul 2009 15:38:35 +0200 References: <6D108219-1BAE-43EF-BEE2-6D0DE33257DB@googlemail.com> <200907141023.34171.waqner@gmx.net> <4A5DD765.60809@gmail.com> X-Mailer: Apple Mail (2.935.3) X-Virus-Checked: Checked by ClamAV on apache.org >> ---snip-map-- >> function(doc) { >> for( var field in doc ) { >> if( field.indexOf('_') != 0 ) { >> emit( field, doc[field] ); >> } >> } >> } >> ---snip-map-- > > If you emit([field, doc[field]], null); > > (ie, make the value itself part of the key) and a simple '_sum' > reduce, then querying with group=true you should get that unique list? Yes, indeed! Guess I have to do some more unlearning :) But, I will for the time being use my current method of creating a design document for each field the user want this information for. Since users are now storing complex objects using my library, I want to avoid all the complex and often large data to be indexed. So they can now define for which fields the views are updated automatically... Daniel