Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 64031 invoked from network); 17 Jan 2009 13:00:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Jan 2009 13:00:10 -0000 Received: (qmail 55811 invoked by uid 500); 17 Jan 2009 13:00:09 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 55767 invoked by uid 500); 17 Jan 2009 13:00:09 -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 55756 invoked by uid 99); 17 Jan 2009 13:00:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 17 Jan 2009 05:00:09 -0800 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [83.97.50.139] (HELO jan.prima.de) (83.97.50.139) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 17 Jan 2009 13:00:00 +0000 Received: from [192.168.1.100] (f053003248.adsl.alicedsl.de [::ffff:78.53.3.248]) (AUTH: LOGIN jan, TLS: TLSv1/SSLv3,128bits,AES128-SHA) by jan.prima.de with esmtp; Sat, 17 Jan 2009 12:59:38 +0000 Message-Id: <81E746F3-F2DE-480E-9DA5-22DC4A18824B@apache.org> From: Jan Lehnardt To: user@couchdb.apache.org In-Reply-To: <630444.43771.qm@web57613.mail.re1.yahoo.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Subject: Re: Better way to count attachments? Date: Sat, 17 Jan 2009 13:59:07 +0100 References: <630444.43771.qm@web57613.mail.re1.yahoo.com> X-Mailer: Apple Mail (2.930.3) X-Virus-Checked: Checked by ClamAV on apache.org On 17 Jan 2009, at 01:51, Bradford Winfrey wrote: > I thought spidermonkey provided a __count__ method, sorry to > justtjink aloud, out and about at the moment It does https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object and it works for me (Spidermonkey 1.7), but it is nonstandard and we shouldn't encourage its use. > > > Sent from my iPod > > On Jan 16, 2009, at 6:44 PM, "Jeff Hinrichs - DM&T" > wrote: > > I am writing a view where the number of attachments is emit'd > > function(doc) { > var cnt = 0; > for (var att in doc._attachments){ > cnt = cnt+1; > } > emit(cnt,doc._attachments); > } > > Is what I came up with. Is there a more elegant solution than this? > > > Regards, > > Jeff > > > > >