You can limit attachments __number__ with validate_doc_update function. Like
function(newdoc, olddoc, userctx, secobj){
if (newdoc._attachments && Object.keys(newdoc._attachments).length >= 20){
throw({"forbidden": "too many attachments"})
}
}
However, you couldn't check attachment's size inside validate functions.
--
,,,^..^,,,
On Thu, Sep 5, 2013 at 2:17 PM, Stanley Iriele <[email protected]> wrote:
> That...was more simple than I was expecting...ok ok. I want to limit the
> number of attachments a document can have at any given time to say...20 or
> so...(I could probably find this out just by testing it to be honest)..can
> I use a show function to then call Object.keys on attachments to get that
> number?...the Documentation says it only saves the meta information about
> the data in the Doc...I guess its just going so smoothly its making me kind
> of nervous :-)
>
>
> On Thu, Sep 5, 2013 at 3:07 AM, Alexander Shorin <[email protected]> wrote:
>
>> > If I delete a document with attachments using the DELETE http verb I am
>> guessing the actual document and attachments are deleted as well?
>>
>> yes
>>
>> > will using the _deleted true preserve the attachments in the database?.
>>
>> yes
>>
>>
>> --
>> ,,,^..^,,,
>>