These are chat archives for Automattic/mongoose

Jul 2018
Zakiir Juman
Jul 25 2018 00:25
Can anyone give me a little insight as to why the 'init' post hook is now synchronous?
I was using it as a way to implement a transaction-type functionality, basically I had a flag on my document that instructed my middleware to delete a bunch of documents in another collection when set.
if anyone else has suggestions as how I should be implementing that that would be great
Jul 25 2018 01:06
@zakiirjuman If it was working before I’m pretty sure it should still work. I think just the docs changed with regard to init hooks. Have you tested it?
Zakiir Juman
Jul 25 2018 01:10
actually I realized that there are a few instances in my init functions where I accidentally don't call next(); they work fine, without the invocation which means it was probably never using it in the first place.
still, not good practice so I'll have to go and remove them and make some notes.
I guess it's better for me to stick to whatever methods mongo was suggesting in implementing multi-phase commits.
Zakiir Juman
Jul 25 2018 01:19
and no, I have not tested it with the newest version of Mongoose. I'm still on 4.x as I was afraid to upgrade.
Jul 25 2018 03:57
hi guys, how can I do bulk update then return the updated documents in mongoose. updateMany() doesnt return the updated documents. thanks in advance