i’d like to use ottoman in my node server.
I was wondering if there is a way to “extend” a base model when i create a model.
What i’d like to do is like extending a base class with generic methods which could be used by every model that extend it. For example, i’d like to add for every model a “created_at” and “update_at” filed, and set them in a pre save function. Or a static function
getAll() that return every document related to that model.
Is it possible?
An example could be what Mongoose for MongoDb calls plugins, http://mongoosejs.com/docs/plugins.html.