lib/utils.js
function(target, source) {
  var translations = {
    // SSL translation options
    sslCA: 'ca',
    sslCRL: 'crl',
    sslValidate: 'rejectUnauthorized',
    sslKey: 'key',
    sslCert: 'cert',
    sslPass: 'passphrase',
    // SocketTimeout translation options
    socketTimeoutMS: 'socketTimeout',
    connectTimeoutMS: 'connectionTimeout',
    // Replicaset options
    replicaSet: 'setName',
    rs_name: 'setName',
    secondaryAcceptableLatencyMS: 'acceptableLatency',
    connectWithNoPrimary: 'secondaryOnlyConnectionAllowed',
    // Mongos options
    acceptableLatencyMS: 'localThresholdMS'
  };

  for (var name in source) {
    if (translations[name]) {
      target[translations[name]] = source[name];
    } else {
      target[name] = source[name];
    }
  }

  return target;
}
function(target, source) {
  var translations = {
    // SSL translation options
    sslCA: 'ca',
    sslCRL: 'crl',
    sslValidate: 'rejectUnauthorized',
    sslKey: 'key',
    sslCert: 'cert',
    sslPass: 'passphrase',
    // SocketTimeout translation options
    socketTimeoutMS: 'socketTimeout',
    connectTimeoutMS: 'connectionTimeout',
    // Replicaset options
    replicaSet: 'setName',
    rs_name: 'setName',
    secondaryAcceptableLatencyMS: 'acceptableLatency',
    connectWithNoPrimary: 'secondaryOnlyConnectionAllowed',
    // Mongos options
    acceptableLatencyMS: 'localThresholdMS'
  };

  for (var name in source) {
    if (translations[name]) {
      target[translations[name]] = source[name];
    } else {
      target[name] = source[name];
    }
  }

  return target;
}
function ( target , source ) { var translations = { // SSL translation options sslCA : 'ca' , sslCRL : 'crl' , sslValidate : 'rejectUnauthorized' , sslKey : 'key' , sslCert : 'cert' , sslPass : 'passphrase' , // SocketTimeout translation options socketTimeoutMS : 'socketTimeout' , connectTimeoutMS : 'connectionTimeout' , // Replicaset options replicaSet : 'setName' , rs_name : 'setName' , secondaryAcceptableLatencyMS : 'acceptableLatency' , connectWithNoPrimary : 'secondaryOnlyConnectionAllowed' , // Mongos options acceptableLatencyMS : 'localThresholdMS' } ; for ( var name in source ) { if ( translations [ name ] ) { target [ translations [ name ] ] = source [ name ] ; } else { target [ name ] = source [ name ] ; } } return target ; }
Merge options with translation
Merge options with translation