1602/jugglingdb — Issue #6: Howto for hooking beforeUpdate/beforeCreate/beforeSave etc.
Author: mweibel
Created: 2011-11-18 07:39:44+00:00
State: open

Hi,

could you please explain how to use those hooking functionalities?

Do I have to use it like that:
```javascript
var foo = schema.define('foo', {
bar: String
});

foo.beforeSave = function(fooInstance) {
fooInstance.bar = fooInstance.bar + 'foobar';
}
```

Also I'm interested in hearing how the three mentioned correlate with each other.. Is some e.g. beforeSave also called when updating/creating a row?

Thanks,
Michael