Node Auth Tutorial (JWT) #6 - Mongoose Hooks

preview_player
Показать описание
In this Node auth tutorial we'll take a look at how mongoose hooks can be used to fire code at different points when documents are saved to the database.

🐱‍👤🐱‍👤 JOIN THE GANG -
----------------------------------------
🐱‍💻 🐱‍💻 My Udemy Courses:

🐱‍💻 🐱‍💻 Course Files:

🐱‍💻 🐱‍💻 Other Related Free Courses & Links:

🐱‍💻 🐱‍💻 Social Links:
Рекомендации по теме
Комментарии
Автор

In mongoose 5.x, instead of calling next() manually, you can use a function that returns a promise and use async/await syntax. Btw, you have great tutorials :)

ПанЧиЛо
Автор

your channel is always my go to whenever I don't understand anything

patapon
Автор

You are a life saver dude! Thanks for all you do for us nerdlings

TheGingerpeer
Автор

U really did a great job on explaining these concepts! Appreciate your works as usual!

ching-tangwang
Автор

mongoose middleware!!! Mind blown. Oh, how I love learning new things :-D

destinlee
Автор

Toad is the greatest video game character ever conceived.

davidk
Автор

your react firegram project is awesome!, hope to see more projects on React and the PERN stack, :), thank you so much

mossasameer
Автор

Hello,

Just a simpler way to hash password.

Use a mongoose setter to hash password every time the value is set or updated.

On your schema, on the password field, a set key -> {... type: String, set: value => hashPasswordFunction(value), ...}

It easier, simpler and it is working both in creation or edition.

nyhillius
Автор

keep the good work bro, absolutely loved it simple and easy 🧡

moaaztarik
Автор

Wow! TIL there's mongoose hooks. really useful since I always hash my passwords in the route itself. thanks shaun!

jomarkpangan
Автор

Interesting :)
What I understood, this time, is that — thanks to the asynchronous instantiation —, we can use middlewares to hook an event and make some pre- and post-processes.
It's a really useful way to learn all the advantages of these features (asynchronous + middlewares + hooks).
Thanks a lot.

fredpourlesintimes
Автор

Really loving this tutorial series, it came at the right time for me in my programming journey. I have found that it's best to simply watch your tutorials start to finish without taking notes, and then opening up the project file at the end from GitHub and seeing how much I remember. I know everyone's style is different, and this maybe a bit selfish, but i thought i'd suggest it anyway - as these are predominantly tutorials, it would be cool (at least for me :P) if there were more tutorial-comments in the code for us to refer to in future. I suppose I'm just lazy though. I should probably comment along the actual code as I watch. But might need to halve the speed. Where are you from? I can't tell if it's Manchester or more Newcastle-way. My dad overheard your voice and said 'bloody 'ell he should teach the masses with that voice' :D

jampackedjames
Автор

So with combination of hooks can we make mongo db realtime as firestore?

tesla
Автор

can this keyword be use with arrow function? or is there better way for arrow function?

liferc
Автор

What should I do next
Can you make a pathway video to know how should we follow your playlist from your channel for every technology covered on your channel?

prafulrane
Автор

still waiting for Node with firebase from GOAT !!

Lerndemy
Автор

So if I understood correctly, when you call "const user = await User.create({ email, password });" to create a user, the "post" hook is afterwards called and when this hook calls the "next();" function, it returns control to the controller "exports.signup_post" for it to complete the rest of its code? (ex : sending the response to the client) Thanks

andromilk
Автор

I have a question how to pass the custome error from shema.post to routes and send it to the forntend

reynandelizo
Автор

Hello! Thx for your great videos. I'm having a problem with this: Once I create the post("save") hook, it fires in every creation of an instance of any schema. Not only the schema that I created the hook for. So, I have a postSchema, userSchema, subscriptionSchema, but the userSchema.post("save", fn(x, y)) hook fires when I create a new instance of postSchema or subscriptionSchema.
Any idea why this might happen?

robtangled
Автор

When I use the "this" keyword it is returning null, does anyone know why?

Edit: just found out I cannot use an arrow function there

harsha