incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zachary Zolton <zachary.zol...@gmail.com>
Subject Re: Get Document Size
Date Fri, 04 Dec 2009 15:33:13 GMT
You mean something like this map function?

function(doc) {
  function toJson() {
    // code...
  }

  emit(doc.someAttr, length(toJson(doc)));
}


On Fri, Dec 4, 2009 at 3:46 AM, Andreas Pavlogiannis
<paulogiann.couchdb@gmail.com> 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.
>
> 2009/12/4 Sebastian Cohnen <sebastiancohnen@googlemail.com>
>
>> what about doing a HEAD request and look for Content-Length?
>>
>> {~} I curl -I http://localhost:5984/test/DOCUMENT-ID
>> HTTP/1.1 <http://localhost:5984/test/DOCUMENT-ID%0AHTTP/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=utf-8
>> Content-Length: 169
>> Cache-Control: must-revalidate
>>
>>
>> On 04.12.2009, at 10:17, Andreas Pavlogiannis wrote:
>>
>> > Hello,
>> >
>> > Is there a uniform way to obtain a document's size (attachments' size
>> included) ?
>> >
>> > Thanks, Andreas
>>
>>
>

Mime
View raw message