hettlage (133) [Avatar] Offline
The text notes that "[a] pre hook on save is run anytime the user is saved. That means on creation and after an update.". This might be a bit misleading, as it is not called when using update or findOneAndUpdate. Quoting from http://mongoosejs.com/docs/middleware.html: "Pre and post save() hooks are not executed on update(), findOneAndUpdate(), etc. You can see a more detailed discussion why in this GitHub issue. Mongoose 4.0 has distinct hooks for these functions."
TheWexler (56) [Avatar] Offline
Yes and no. You are correct in that the update methods themselves do not invoke the pre-save hook. When I wrote that line I intended using the `save` method on a User instance to update the user's information. I will need to reword the text.

In other words, in the following two examples the pre-save hook on the User model would run:

var user;
User.create({name: {first: 'Jon', last: 'Wexler '}, email: 'jon@jonwexler.com', password: 'pass123'}).then(u => user = u);


use.email = 'info@jonwexler.com';

I'll make that more clear in that section. Thanks for pointing that out.