These are chat archives for Automattic/mongoose

Aug 2015
Aug 21 2015 03:08
so just started using mongoose, how to tell mongoose to disconnect after it's buffer has been flushed?
right now if i do a bunch of, then db.close(), nothing actually saves
Roland N Sharp
Aug 21 2015 05:58
Hi, I'm having an issue when using mongoose pre.validate in a plugin. I'm trying to modify the document, but I can't even access this unless I cast it .toObject();
Any Ideas?
I'm trying to do some conditional logic that will modify the document in this middleware
James Lee
Aug 21 2015 05:59
Aug 21 2015 15:39

This article shows how to do a username/password auth. It hashes the password on save, with a pre hook:

it then says the 'pre' hook only gets called on save, not update.
What does one do when he wants to update a field that has a hook? re-save the whole document?