Cleanup code in config/bootstrap.js
#138
Closed
MaheshkumarSundaram
started this conversation in
General
Replies: 1 comment 1 reply
-
@MaheshkumarSundaram you don't need to worry about closing connections; once the process is ended, the connection is closed. This is an exercise is futility. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi @neonexus
In my Sails.js webapp, I am using a MongoDB in addition to the MySQL one. I don't use
models
for MongoDB as it involves complex querying (aggregation pipelines).So, I have created a service
MongoDbService.js
which usesMongoClient
. Tto effectively deal with start up connection to Mongo & final clean up, I have added the below inconfig/bootstrap.js
:The connection setup is fine and i don't any issues while querying & stuff.
But when I exit the webserver, I have no indication that the MongoDB connection is closed. I don't see any console logs related to disconnect.
How do I confirm the connection close is happening?
Could you please provide any insight on this? Thank you.
Beta Was this translation helpful? Give feedback.
All reactions