These are chat archives for Automattic/mongoose

21st
Aug 2015
secretofmana
@secretofmana
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 Blah.save(), then db.close(), nothing actually saves
Roland N Sharp
@rolandnsharp
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
@uptownhr
Aug 21 2015 05:59
console.log(‘testing’);
bruce
@sqram
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: http://blog.mongodb.org/post/32866457221/password-authentication-with-mongoose-part-1

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?