Sounds good, thank you! I'll make a try.

2011/8/3 Gabor Ratky <[email protected]>

>  Hans,
>
> the sizes (length) of the attachments are available under doc._attachments.
> So the size of the first attachment is
> doc._attachments['name_of_attachment.txt'].length. You can iterate over this
> object easily and sum up the sizes. You can also:
>
> map: '''
> emit(doc._id, JSON.stringify(doc).length)
> for attachment_name in attachments
> emit(doc._id, attachments[attachment_name].length)
> '''
>
> reduce: '_sum'
>
> and let CouchDB reduce to the sum of sizes.
>
> Gabor
>
>
> On Wednesday, August 3, 2011 at 1:34 PM, Hans-Dieter Böhlau wrote:
>
> > Hi *,
> > I'd like to calculate the size of a number of documents within a view ...
> to
> > estimate the download-volume for the replication to client side.
> > My idea is to calculate the size of each document within the map function
> > and to sum up the values within the reduce step.
> >
> > How can I calculate the size of a document (including attachments!)
> within
> > the map function?
> >
> > Thank you for help,
> > Hans
>
>

Reply via email to