Couldn't find a way how to create such model hook on nestjs.
I see how to create pre/post hooks that attached to schemas, but this one is specifically needs to be attached to model.
Is this somehow possible to do in MongooseModule.forFeatureAsync factory ?
Example from doc: https://mongoosejs.com/docs/guide.html#indexes
// Will cause an error because mongodb has an _id index by default that
// is not sparse
animalSchema.index({ _id: 1 }, { sparse: true });
const Animal = mongoose.model('Animal', animalSchema);
Animal.on('index', error => {
// "_id index cannot be sparse"
console.log(error.message);
});