I don’t know the specific usage of next, and the concept of entering the next part is a bit vague, in which auauau can be output first and user can be output later.
The latter user is the user I output after the salt callback, and I can see that the output password after the second next is salted.
I started to think that the two nexts can have an overlay relationship, but it seems to be stored in the database based on the object this points to when the first NEXT is executed.
After checking the database, it was based on the status of the first next.
Then I have something I don’t understand. Is the second next () execution a failure or what? Among them, the next operation did exactly the What?
nextIs to run the next middleware.
Because many operations of js inside are asynchronous, and there are two asynchronous ways, one is
mongooseMost scenes use
callbackThis is no exception.
I didn’t look at the following instructions, just look at the code in the first picture and there is a problem.
The code in the first picture,
nextIt will always be called twice.
Put the bottom third row