Replica set has socket options: http://mongodb.github.io/node-mongodb-native/2.1/api/ReplSet.html
Also, server has socket options http://mongodb.github.io/node-mongodb-native/2.1/api/Server.html
Now, I connect to my replica as
var MongoClient = require('mongodb').MongoClient;
var ReplSet = require('mongodb').ReplSet;
var Server = require('mongodb').Server;
var servers = [
new Server('srv1', 27017, {socketOptions: {socketTimeoutMS: 100000}}, new Server('srv2', 27017, {socketOptions: {socketTimeoutMS: 100000} }, new Server('srv3', 27017, { socketOptions: {socketTimeoutMS: 100000}},];
var replSet = new ReplSet(servers, {
socketOptions: { socketTimeoutMS: 666666 }
});
var dbConnStr = "mongodb://user:pass@srv1,srv2,srv3/mydb?replicaSet=lw&readPreference=secondary";
MongClient.connect(dConnStr, {replSet: replSet}, {function(err, dbConn) {
//
});
Now the question: what socket timeout is actually applied when settings for replica set are different from settings for each server in server array.
Also, bonus question: why do i need to set replica servers on connection string if there is an array in replica set object?