#86 Query Middleware | Using MongoDB with Express | A Complete NODE JS Course
HTML-код
- Опубликовано: 25 ноя 2024
- In the last lecture, we learned about document middleware of mongoose. In this lecture, let's learn about query middleware. Query middleware allows us to run a function before or after a query get executed.
❤❤❤
isn't this.find in post hook unnecessary? because the query has already run on the db, if we really want to filter, shouldn't we use filter method on docs itself?
I came in comments section to ask the same question. I think he forgot to remove it since he copy-pasted the pre-hook. I googled around and came to know modifying the query in a post hook won't affect the actual database query that was executed.
So it's just a mistake.
@procademy
Sir mongo se connect nhi hora