I want to execute same script in the pre-hook with multiple methods like this:
UserSchema.pre("findOne", function(next) {
console.log("Common code");
});
&
UserSchema.pre("findOneAndUpdate", function(next) {
console.log("Common code");
});
So, as you can notice in the above 2 scripts that they both are executing the same code but have different methods: findOne & findOneAndUpdate.
So, is there any way to register both pre-hooks with the same code all at once?