mongodb - Idle Connection Timeout in mongoose -


is there way set idle connection timeout in mongoose ? trying 1 below.

mongoose.createconnection(ip:port/{server:{"maxidletimems":1800000}}) 

but above code doesn't seem work. appreciated

this option called connecttimeoutms not maxidletimems , socket option. sample code work :

var uri = 'mongodb://localhost/mydb'; var options = { server: { socketoptions: { connecttimeoutms: 1800000}}};  mongoose.createconnection(uri, options, function (err) {      if (!err){     console.log("connection successful");}  }); 

good luck


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -