After reading this paragraph in the CouchDB Definitive Guide (here):
If you have multiple design documents, each with a validate_doc_update function, all of those functions are called upon each incoming write request. Only if all of them pass does the write succeed. The order of the validation execution is not defined. Each validation function must act on its own.
I'm wondering if there is any good practice to deal with multiple validate_doc_update function ?
I mean: Is it better to create only one design document with a validate_doc_update field or having several smaller ones?
In the first case, one can be sure that none of the validation functions will interfere with another, but the function may become very large if a lot of controls are needed.
On the other side, several smaller functions may be easier for reading purposes and evolutions, but one have to be sure of the purpose of each function and not mess with other ones.
Plus, what's the point of letting each design document hold a validate function? Storing one in a view document seems a bit dirty for instance, but creating several design documents just for the intent of holding one small validation function doesn't seems very clever to me either.
What do you think?
I may have missed something, that's the point of my question, is there any good practices about the management of multiple validate_doc_update function?