Behavior of the Variable this in Validation with Mongoose + Nodejs

Asked

Viewed 27 times

-1

I’m trying to run a validation process for a field in the Mongoose schema. However, the behavior of the variable "this" is different than expected. Because according to the documentation in: http://mongoosejs.com/docs/validation.html#update-validators-and-this, should refer to the object of the model being saved. However, when debugging in Vscode the reference Local to this is correct, but the reference indicated by the "Watcher" is another, the reference of the module class. Can anyone tell me why this is happening? How to access the correct reference in this context?

Exemplo do Debug

1 answer

0

Browser other questions tagged

You are not signed in. Login or sign up in order to post.