couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Lehnardt <>
Subject Re: Sharing code between validation functions for different views.
Date Tue, 02 Jun 2009 12:57:47 GMT

On 31 May 2009, at 05:46, macario wrote:

> I am toying with document validation and I would like not to repeat  
> the same
> validation functions on each validate_doc_update,
> I've read that validate_doc_update for each view are ran in an order  
> given
> by couchdb, so is there any way I can load some functions before the  
> whole
> validation process?

Do you mean validate_doc_update for each design document (each design
document can include multiple views). You can't run a function before  
one validation function. If we had a "pre_update_validate" hook, it'd  
guaranteed execution order and if we'd want that we could add it for  
validation functions as well. As fast as sharing code, you can use  
library feature, where your code only lives in one place when you  
but gets copied when pushed to CouchDB.



View raw message