couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Shorin <kxe...@gmail.com>
Subject Re: commonjs in validation docs
Date Mon, 03 Jun 2013 07:37:06 GMT
Nice found Stephen! Indeed, this is a "bug" and my bad (:
"validate_doc_update" field should be on the same level as "views"
one.
--
,,,^..^,,,


On Mon, Jun 3, 2013 at 11:30 AM, Stephen Bartell <snbartell@gmail.com> wrote:
> I thought it was strange too,  but thats from the docs (http://couchdb.readthedocs.org/en/latest/query-servers.html#commonjs-modules).
The way I interpret the example is "its ok to put validation docs inside the views field so
that you can have access to commonjs exports.".  This must just be a shitty example.
>
>
> On Jun 3, 2013, at 12:21 AM, Aurélien Bénel <aurelien.benel@utt.fr> wrote:
>
>> Hi Stephen,
>>
>>> So I can't seem to get a validate_update_doc nested in a view field to work.
>>
>> Why would you do that? Validations and views are completely different concepts.
>>
>>>  "views": {
>>>      "validate_doc_update": "function(newdoc, olddoc, ctx, sec) {throw {forbidden:
'You shall not pass.'}}" // this one doesn't work
>>
>> If you write this, `validate_doc_update` will be just a view. I'm pretty sure this
is not what you want.
>> As a view, it should have a map and could have a reduce function, but would have
nothing to do with validation.
>>
>>
>> Regards,
>>
>> Aurélien
>>
>

Mime
View raw message