What are hooks in Mongoose ? | Mongoose middleware | Learn backend development in hindi

Поделиться
HTML-код
  • Опубликовано: 28 ноя 2024

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

  • @Pepcoding
    @Pepcoding  3 года назад +1

    🚨 Backend Development: ruclips.net/p/PL-Jc9J83PIiEnK1q9tuVrrORqKBexcE_J

  • @ankitkumarmishra7753
    @ankitkumarmishra7753 2 года назад +16

    FYI - if the pre and post hooks are not working, just put them above the mongoose.model('userModel',userSchema) function call.

  • @madhavanand756
    @madhavanand756 3 года назад +6

    Object ID Parts
    It is a 12-byte value consists of
    4-byte timestamp value, representing the ObjectId's creation, measured in seconds since the Unix epoch
    5-byte random value generated once per process. This random value is unique to the machine and process.
    3-byte incrementing counter, initialized to a random value

  • @jyoti6727
    @jyoti6727 5 месяцев назад

    Nice explanation!❤️

  • @Iqravlogs55
    @Iqravlogs55 Год назад +3

    Your videos is good but sound is to low plz change mike

  • @0.1tahmidemam14
    @0.1tahmidemam14 6 месяцев назад

    good teaching

  • @madhavanand756
    @madhavanand756 3 года назад +4

    Backend Streak #17

  • @nikhilyadav-ro7me
    @nikhilyadav-ro7me Год назад

    if we want to change something in data or after saving in database we use hooks

  • @sarthakgarg9043
    @sarthakgarg9043 Год назад

    mast ekdum

  • @thepulkitsood
    @thepulkitsood 3 года назад

    STREAK # 17 🤩👨‍💻

  • @ps6846
    @ps6846 2 года назад

    is it possible to update existing schema in between ? 'Like removing unique constraint from email' ?

  • @deepakverma-uo7pf
    @deepakverma-uo7pf Год назад

    nice sir

  • @shahidabbas2932
    @shahidabbas2932 3 года назад

    sir g schema design pa ek video banawo

  • @madhavanand756
    @madhavanand756 3 года назад

    Remove
    It will be used in hook when delete action triggers instead of save.

    • @sejalagarwal4867
      @sejalagarwal4867 3 года назад

      But what is the use of delete hooks I didn't understand .
      I tried to implement this
      userSchema.post('remove',function(doc){
      console.log("Db removed",doc)
      })
      For pre also I used remove but noting happened .It didn't remove anything.I didn't understand much from documentation

    • @omyerawar7976
      @omyerawar7976 3 года назад +1

      @@sejalagarwal4867 pre and post is not for deleting the documents from db, they can be use to perform some other tasks before or after deleting the document. Hope now you understood :)

    • @sejalagarwal4867
      @sejalagarwal4867 3 года назад

      @@omyerawar7976 thanks

  • @chitreshkaushik6980
    @chitreshkaushik6980 3 года назад

    hooks are not working and no error occur as well, please help me the first two pre and post hooks on userschema does not work at my end.Everything else is working.

    • @Pepcoding
      @Pepcoding  3 года назад

      For better experience and well-organised content
      Visit - nados.pepcoding.com
      You can post your query on community tab.
      Don't forget to follow us on Instagram
      instagram.com/pepcoding/

    • @abhishekkaintura6398
      @abhishekkaintura6398 2 года назад

      bro how you solved this problem

  • @PrashantNirgun
    @PrashantNirgun 2 месяца назад

    hook is not working with Mongooese 8.5.3 I checked all its not working

  • @rishirajsingh4821
    @rishirajsingh4821 10 месяцев назад

    why he doesnt make a seprate file for each video ??its kind of confusing ,every previous code in one video only
    apart from that the tuotorials are very good