| Message view | « Date » · « Thread » |
|---|---|
| Top | « Date » · « Thread » |
| From | Samuel Williams <space.ship.travel...@gmail.com> |
| Subject | Re: validate_doc_update response? |
| Date | Sun, 22 Jul 2012 09:24:45 GMT |
Sorry, that is supposed to be:
ddoc = {
validates: [
{
match: function(document) { return document.type == 'user'; }
validate: function(new_doc, old_doc, user_context) {
if (!user_context.admin || old_doc.username == user_context.username)
throw 'forbidden', ...;
}
}
]
}
And you'd go from top to bottom calling match, and if match returned true,
call validate.
| |
| Mime |
|
| View raw message | |