I am following a tutorial where the following code is placed inside the users.ts file, inside a User model.
users.ts
userSchema.pre(\'save\', async functi