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

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -