These are chat archives for Automattic/mongoose

4th
Jan 2018
Nick Karnik
@theoutlander
Jan 04 2018 06:54
@lineus sorry got busy all day … so, I would suggest learning some of the concepts first
Learn about promises
And callbacks
what the differences are
Then, get into the mongoose api ...
In the example above, if remove is a promise then it may not work (but I don’t understand why the docs have that as an example then)
Kev
@lineus
Jan 04 2018 09:46
@theoutlander I think I figured it out. In the example code the parent is a new model instance but in my case i was using the return from a query. It would make sense in that case that the example's call to remove would be synchronous but mine wouldn't be.
RENAN.BASTOS
@renanbastos93
Jan 04 2018 13:11
Hey guys
what's up?
I need of help.
I want understand as function the connects at mongoose
Example: I connect as global and use db.useDb("database"), but and step find it open new connection and the machine burding CPU usage. I want desconnect connexion later of response the user/ people. How I should make?
Sorry my English, I'm studying here Brazil!
RENAN.BASTOS
@renanbastos93
Jan 04 2018 13:17
Someone, Can help-me?
Nick Karnik
@theoutlander
Jan 04 2018 19:30
@renanbastos93 have you looked at the mongoose docs?
Kev
@lineus
Jan 04 2018 22:08
@theoutlander I wrote an example to show you what I was seeing, and it behaves differently than what I was seeing in my project ( of course )
gist here
I just wanted to throw it out there that the promise being returned must be related to my implementation.
Nick Karnik
@theoutlander
Jan 04 2018 22:49
@lineus glad you got that working! Thanks for posting the solution. I got confused after thinking about the weird behavior