V
V
Vladimir Mirka2017-11-17 14:10:17
MongoDB
Vladimir Mirka, 2017-11-17 14:10:17

Mongoose - why is the middleware not responding when data is updated?

I send a PUT request. On the server, the document is searched for by ID and updated. After the scheme, I catch it as follows:

UserSchema.pre('save', async function (next) {
   ....
});

But the request does not cling to the handler and goes directly.
I tried to write updateand findOneAndUpdate- the result is the same.
What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question