[ 
https://issues.apache.org/jira/browse/COUCHDB-1519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13426521#comment-13426521
 ] 

Damjan Georgievski commented on COUCHDB-1519:
---------------------------------------------

The two mechanisms will stay as independent as they are now (considering they 
do share the doc object for ex.). Only validate_doc_update will get more 
knowledge of the circumstances of the document update. In other words I propose 
a shared and updateable "context" object.

My use case is that I can make several checks in an update handler, comparing 
the user request to the stored document, that I can't do in the 
validate_doc_update handler. But since update functions can be evaded, I can't 
depend on them.

The validate_doc_update handler doesn't have access to the request object, 
which is fine, but I think it needs the knowledge if it's a direct to db 
request or a request through an update function.
                
> Allow validate_doc_update.js to be aware if the update went through an update 
> function before
> ---------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-1519
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1519
>             Project: CouchDB
>          Issue Type: New Feature
>          Components: Database Core
>    Affects Versions: 1.2
>            Reporter: Damjan Georgievski
>
> It would be useful for the validate_doc_update function to "know" if the 
> document has been processed by an update function or is sent directly to the 
> DB.
> There are several possible ways to do it:
> * allow the update function to update either the userCtx or the secObj 
> objects, and let that change propagate to the validate_doc_update function
> * add a completely new object that will be passed to both functions. update 
> functions could then modify it.
> * add some flag to validate_doc_update parameters to signal that the document 
> is direct to DB or not. But this would limit the usefulness of the feature.
> Adding special attributes to the document object, in an update function, that 
> the validate function can check later, is not sufficient since that attribute 
> can be sent directly to the DB also, and will be stored in the database.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to