Open alechenninger opened 8 years ago
All hooks are processed after the CRUD operation. In the case of all but read, this means data changes are made. We don't have transactions with mongo backend.
I think to fail a request or modify the request we need a pre-CRUD capability (similar to pre insert, update, delete trigger in RDBMS). It would make sense for these hooks to cause failure.
I kind of like hooks as an extension mechanism. What if you could use a hook for additional validation? If a hook could fail a request, you could use it for this kind of thing. So maybe it would be cool allow hooks to deliberately fail a request, or even modify it.
Hooks as extensions is really only a powerful construct if hooks could be loaded at runtime (which there is another issue for somewhere).