These are chat archives for Automattic/mongoose

27th
Aug 2015
Ashley Drake
@aldraco
Aug 27 2015 16:37
@sqram hi, new to the chat room :) what are you trying to accomplish? are you trying to update the password, or do you just want a different hook to be called when you update a document?
You can add a separate pre 'update' hook if you like.
check this out for more information http://mongoosejs.com/docs/middleware.html and scroll to the bottom
bruce
@sqram
Aug 27 2015 16:39
@aldraco thank you for the reply. Yes, i saw that in the doc the next day i asked. thank you
but i still have the question - why hash it using hooks? why not hash it and normally save/update the document using the hashed pw as a string
Ashley Drake
@aldraco
Aug 27 2015 17:05
@sqram I guess you could do it that way, too, but you would want to check if the user changed their password, so having a hook method is probably more convenient. Just a guess.
bruce
@sqram
Aug 27 2015 17:55
@aldraco thanks for the input. looks like a matter of preference