These are chat archives for Automattic/mongoose

29th
Jan 2018
Koby Picker
@JKobyP
Jan 29 2018 02:32
No promises -- the matching algorithm uses async.waterfall and async.parallel to do some tasks
@lineus
Kev
@lineus
Jan 29 2018 02:47
@JKobyP are you calling db.close() in your matching algorithm?
if sharing the relevant code in a gist is an option for you I'll take a look at it and see if I can offer any suggestions.
Koby Picker
@JKobyP
Jan 29 2018 02:59
@lineus db.close() is actually never called. (Which I suppose ought to be a resource leak)
It seems like the connection gets severed when the main thread finishes, which is confusing to me because I haven't seen that behaviour documented or discussed anywhere. And in fact, when I set a very long timeout on the main thread, the matching process completes fine (without the timeout, calls to mongoose hang).
Sharing the code isn't an option for me right now unfortunately
Kev
@lineus
Jan 29 2018 03:06
yeah, that's a weird one, I would expect the connection to persist if you aren't calling close() or process.exit, etc
turab007
@turab007
Jan 29 2018 07:28
Hi, Need some help.
Is there any possibility that we can query inside mongoose virtual or hook and append that result to mongoose object. Like in my case I have to append count of some other collection and append it to each object.