Answer the question
In order to leave comments, you need to log in
How to make MongoClient (mongodb package from node.js) try to connect to database again?
var http = require('http')
, mongodb = require('mongodb');
var options = {
{
uri_decode_auth: true,
numberOfRetries: 1000,
db: {
numberOfRetries: 1000,
retryMiliSeconds: 5000,
bufferMaxEntries: 0
},
server: {
auto_reconnect: true,
socketOptions: {
connectTimeoutMS: 5000,
},
reconnectTries: 1000,
reconnectInterval: 5000,
}
};
mongodb.MongoClient.connect('mongodb://username:[email protected]:27017/dbname', options, function(err, db) {
if (err) {
console.log('failure');
return;
}
console.log('success');
http.createServer(function(request, response) {
}).listen(80);
});
Answer the question
In order to leave comments, you need to log in
Well, you yourself indicated
server: {
auto_reconnect: false,
auto_reconnect: false, maybe you should set it to true first?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question