couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Bartell <snbart...@gmail.com>
Subject Re: commonjs in validation docs
Date Mon, 03 Jun 2013 07:30:55 GMT
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