janl commented on issue #1554: Additional Mango-based update handler / VDU 
functionality
URL: https://github.com/apache/couchdb/issues/1554#issuecomment-412794194
 
 
   I really like where this is going, great first draft!
   
   Quick initial notes up top:
   - I like the unification of VDU and _update into one thing that is logically 
“stuff that happens before a doc hits the db.”
   - I’d leave out `queries` in this example, this would open up having to 
handle cluster network error on the doc write path. We can revisit this at a 
later point, the current design here allows for an easy extension later on. I 
think it’ll simplify the already complex discussions required for a baseline 
feature (which I’m going to extend shortly).
   
   One further aspect that we should discuss the other use of VDUs. To recap, 
VDUs are used to enforce document schema (this is handled in this draft) and 
authorisation, where check doc contents against the context of `ctx`.
   
   
   For Example:
   
   ```js
   function (newDoc, oldDoc, userCtx) {
     // in an authenticated request, userCtx.user is the authenticated username
     // so we can:
   
     if (oldDoc.author != userCtx.name) {
       throw({})
     }
   }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to