#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.

Комментарии • 4

  • @hassannouri9796
    @hassannouri9796 2 месяца назад +1

    ❤❤❤

  • @vinaykumarkharwar177
    @vinaykumarkharwar177 11 месяцев назад +4

    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?

    • @nikharsachdeva896
      @nikharsachdeva896 9 месяцев назад +3

      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

  • @thephalcon
    @thephalcon Год назад +1

    Sir mongo se connect nhi hora