I am working with multiple
AWS intances
connected to the same MongoDB
database (inside Compose.io
Elastic deployment). But i am getting the error server : sockets closed
after a few minutes. Can anyone give me any hint about what may be wrong with the connection code?
**CONNECTION CODE**
var url = "mongodb://:@:,:/?replicaSet=";
var options = {
server : {"socketOptions.keepAlive": 1},
replSet : { "replicaSet": , "socketOptions.keepAlive": 1 }
};
MongoClient.connect(url, options, function(err, db) { ... });
**ERROR MESSAGE**
Potentially unhandled rejection MongoError: server : sockets closed
at null. (/var/app/current/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:328:47)
at g (events.js:199:16)
at emit (events.js:110:17)
at null. (/var/app/current/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js:101:12)
at g (events.js:199:16)
at emit (events.js:110:17)
at Socket. (/var/app/current/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js:142:12)
at Socket.g (events.js:199:16)
at Socket.emit (events.js:107:17)
at TCP.close (net.js:485:12)
Asked by santihbc
(21 rep)
Aug 4, 2015, 01:57 PM
Last activity: Jun 9, 2025, 12:05 PM
Last activity: Jun 9, 2025, 12:05 PM