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
Post a Comment