Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 30024 invoked from network); 4 Dec 2009 16:12:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Dec 2009 16:12:05 -0000 Received: (qmail 5032 invoked by uid 500); 4 Dec 2009 16:12:03 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 4957 invoked by uid 500); 4 Dec 2009 16:12:03 -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 4947 invoked by uid 99); 4 Dec 2009 16:12:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Dec 2009 16:12:03 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sebastiancohnen@googlemail.com designates 209.85.218.218 as permitted sender) Received: from [209.85.218.218] (HELO mail-bw0-f218.google.com) (209.85.218.218) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Dec 2009 16:12:01 +0000 Received: by bwz10 with SMTP id 10so2083518bwz.35 for ; Fri, 04 Dec 2009 08:11:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:content-type:mime-version :subject:from:in-reply-to:date:content-transfer-encoding:message-id :references:to:x-mailer; bh=hyE1j7ewgDzDJJm1duatz1UJXEOOG+DVedF0wCh8Qu0=; b=oGv+nAgwYbxAoOpmRpwHF9FvyFEnNm4DLktF06uWVdy3LAhxMJwPkI7Y4OHnTNIWZs rZXMwcDH0xyjBuvtvm1H7vYmEPIFqcWAI+VqvvhfpPnNAI6PUIQkI2BNFAN4w7Fg3zbo wLQ7YYT8JasL8WFFLoj+eeDdtMkpvVSLvTIlM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; b=sxjdoeayKUgxPX3NXziVDzEt7//hBGSzaWjHt5AvDaUv11frFXtka3az1SUVoOXJjM 3tXdYxzdrBxU4Z9S6pT+zr1TcDHimNCO0pBJ9mNBaKtorPIHvqneFaSWHaIKrJFzPvF0 xWBW8OKtHS1b/zfqQThgoYLI/4sOTAjkQSDBI= Received: by 10.102.95.3 with SMTP id s3mr104266mub.74.1259943099402; Fri, 04 Dec 2009 08:11:39 -0800 (PST) Received: from shakti.fritz.box (koln-5d81993e.pool.mediaWays.net [93.129.153.62]) by mx.google.com with ESMTPS id j10sm8390491mue.0.2009.12.04.08.11.37 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 04 Dec 2009 08:11:38 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1077) Subject: Re: Get Document Size From: Sebastian Cohnen In-Reply-To: Date: Fri, 4 Dec 2009 17:11:36 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: <4B18D3B2.3020108@gmail.com> <3a3e8270912040146u4ce88db8xbda3299dca3ead8d@mail.gmail.com> To: user@couchdb.apache.org X-Mailer: Apple Mail (2.1077) yeah, this looks better :) On 04.12.2009, at 17:08, Zachary Zolton wrote: > This seems to work for attachments: >=20 > function(doc) { > if (doc['_attachments']) { > var attachementSize =3D 0; > for each (var stub in doc['_attachments']) { > attachementSize +=3D stub.length; > } > emit(null, attachementSize); > } > } >=20 >=20 > On Fri, Dec 4, 2009 at 9:46 AM, Sebastian Cohnen > wrote: >> this still does not include the documents attachments... >>=20 >> On 04.12.2009, at 16:33, Zachary Zolton wrote: >>=20 >>> You mean something like this map function? >>>=20 >>> function(doc) { >>> function toJson() { >>> // code... >>> } >>>=20 >>> emit(doc.someAttr, length(toJson(doc))); >>> } >>>=20 >>>=20 >>> On Fri, Dec 4, 2009 at 3:46 AM, Andreas Pavlogiannis >>> wrote: >>>> That might work for a single document, but I 'd rather calculate = the size >>>> inside a map function so that I can then use a reduce to sum up. >>>>=20 >>>> 2009/12/4 Sebastian Cohnen >>>>=20 >>>>> what about doing a HEAD request and look for Content-Length? >>>>>=20 >>>>> {~} I curl -I http://localhost:5984/test/DOCUMENT-ID >>>>> HTTP/1.1 200 = OK >>>>> Server: CouchDB/0.11.0b60a6b3e7-git (Erlang OTP/R13B) >>>>> Etag: "1-1a6c2a80b8615b2399ff5ba66d18534d" >>>>> Date: Fri, 04 Dec 2009 09:38:34 GMT >>>>> Content-Type: text/plain;charset=3Dutf-8 >>>>> Content-Length: 169 >>>>> Cache-Control: must-revalidate >>>>>=20 >>>>>=20 >>>>> On 04.12.2009, at 10:17, Andreas Pavlogiannis wrote: >>>>>=20 >>>>>> Hello, >>>>>>=20 >>>>>> Is there a uniform way to obtain a document's size (attachments' = size >>>>> included) ? >>>>>>=20 >>>>>> Thanks, Andreas >>>>>=20 >>>>>=20 >>>>=20 >>=20 >>=20