scottwrobinson / camo

A class-based ES6 ODM for Mongo-like databases.
556 stars 80 forks source link

preInit hook #88

Open perimetral opened 7 years ago

perimetral commented 7 years ago

As long as constructor is used for schema describing in Camo, i found it is tricky to perform some init actions without appending needed manually after .create() call, so in this patch you may see new preInit hook which is called right in .create() method before returning of model. Hook is syncronous. New data instance is passed to hook in first arg.