using below code in mongoose, when i terminate the connection the console is not showing. instead i am getting some other error '(node:56588) DeprecationWarning: open()
is deprecated in mongoose >= 4.11.0, use openUri()
instead, or set the useMongoClient
option if using connect()
or createConnection()
. See http://mongoosejs.com/docs/connections.html#use-mongo-client' .
process.on('SIGINT',function(){
mongoose.connection.close(function(){
console.log('mongoose disconnected through app termination');
process.exit(0);
});
});