Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Socket options
var socketOptions = options.socketOptions && Object.keys(options.socketOptions).length > 0
? options.socketOptions : options;
// Translate all the options to the mongodb-core ones
clonedOptions = translateOptions(clonedOptions, socketOptions);
if(typeof clonedOptions.keepAlive == 'number') {
clonedOptions.keepAliveInitialDelay = clonedOptions.keepAlive;
clonedOptions.keepAlive = clonedOptions.keepAlive > 0;
}
// console.log("=============== create CReplSet")
// console.dir(clonedOptions)
// Create the ReplSet
var replset = new CReplSet(seedlist, clonedOptions);
// Server capabilities
var sCapabilities = null;
// Listen to reconnect event
replset.on('reconnect', function() {
self.emit('reconnect');
store.execute();
});
// Internal state
this.s = {
// Replicaset
replset: replset
// Server capabilities
, sCapabilities: null
// Debug tag
options.socketOptions && Object.keys(options.socketOptions).length > 0
? options.socketOptions
: options;
// Translate all the options to the mongodb-core ones
clonedOptions = translateOptions(clonedOptions, socketOptions);
// Build default client information
clonedOptions.clientInfo = this.clientInfo;
// Do we have an application specific string
if (options.appname) {
clonedOptions.clientInfo.application = { name: options.appname };
}
// Create the ReplSet
var coreTopology = new CReplSet(seedlist, clonedOptions);
// Listen to reconnect event
coreTopology.on('reconnect', function() {
self.emit('reconnect');
store.execute();
});
// Internal state
this.s = {
// Replicaset
coreTopology: coreTopology,
// Server capabilities
sCapabilities: null,
// Debug tag
tag: options.tag,
// Store options
name: name,
architecture: architecture,
version: release
},
platform: nodejsversion
}
// Build default client information
clonedOptions.clientInfo = this.clientInfo;
// Do we have an application specific string
if(options.appname) {
clonedOptions.clientInfo.application = { name: options.appname };
}
// Create the ReplSet
var replset = new CReplSet(seedlist, clonedOptions);
// Listen to reconnect event
replset.on('reconnect', function() {
self.emit('reconnect');
store.execute();
});
// Internal state
this.s = {
// Replicaset
replset: replset
// Server capabilities
, sCapabilities: null
// Debug tag
, tag: options.tag
// Store options
if(options.connectWithNoPrimary == true) {
finalOptions.secondaryOnlyConnectionAllowed = true;
}
// Add the non connection store
finalOptions.disconnectHandler = store;
// Translate the options
if(options.sslCA) finalOptions.ca = options.sslCA;
if(typeof options.sslValidate == 'boolean') finalOptions.rejectUnauthorized = options.sslValidate;
if(options.sslKey) finalOptions.key = options.sslKey;
if(options.sslCert) finalOptions.cert = options.sslCert;
if(options.sslPass) finalOptions.passphrase = options.sslPass;
// Create the ReplSet
var replset = new CReplSet(seedlist, finalOptions)
// Server capabilities
var sCapabilities = null;
// Add auth prbufferMaxEntriesoviders
replset.addAuthProvider('mongocr', new MongoCR());
// Listen to reconnect event
replset.on('reconnect', function() {
self.emit('reconnect');
store.execute();
});
// Internal state
this.s = {
// Replicaset
replset: replset
// Server capabilities
if(options.connectWithNoPrimary == true) {
finalOptions.secondaryOnlyConnectionAllowed = true;
}
// Add the non connection store
finalOptions.disconnectHandler = store;
// Translate the options
if(options.sslCA) finalOptions.ca = options.sslCA;
if(typeof options.sslValidate == 'boolean') finalOptions.rejectUnauthorized = options.sslValidate;
if(options.sslKey) finalOptions.key = options.sslKey;
if(options.sslCert) finalOptions.cert = options.sslCert;
if(options.sslPass) finalOptions.passphrase = options.sslPass;
// Create the ReplSet
var replset = new CReplSet(seedlist, finalOptions)
// Server capabilities
var sCapabilities = null;
// Add auth prbufferMaxEntriesoviders
replset.addAuthProvider('mongocr', new MongoCR());
// Listen to reconnect event
replset.on('reconnect', function() {
self.emit('reconnect');
store.execute();
});
// Internal state
this.s = {
// Replicaset
replset: replset
// Server capabilities
name: name,
architecture: architecture,
version: release
},
platform: nodejsversion
}
// Build default client information
clonedOptions.clientInfo = this.clientInfo;
// Do we have an application specific string
if(options.appname) {
clonedOptions.clientInfo.application = { name: options.appname };
}
// Create the ReplSet
var replset = new CReplSet(seedlist, clonedOptions);
// Listen to reconnect event
replset.on('reconnect', function() {
self.emit('reconnect');
store.execute();
});
// Internal state
this.s = {
// Replicaset
replset: replset
// Server capabilities
, sCapabilities: null
// Debug tag
, tag: options.tag
// Store options
name: name,
architecture: architecture,
version: release
},
platform: nodejsversion
}
// Build default client information
clonedOptions.clientInfo = this.clientInfo;
// Do we have an application specific string
if(options.appname) {
clonedOptions.clientInfo.application = { name: options.appname };
}
// Create the ReplSet
var replset = new CReplSet(seedlist, clonedOptions);
// Listen to reconnect event
replset.on('reconnect', function() {
self.emit('reconnect');
store.execute();
});
// Internal state
this.s = {
// Replicaset
replset: replset
// Server capabilities
, sCapabilities: null
// Debug tag
, tag: options.tag
// Store options
finalOptions.secondaryOnlyConnectionAllowed = true;
}
// Add the non connection store
finalOptions.disconnectHandler = store;
// Translate the options
if(options.sslCA) finalOptions.ca = options.sslCA;
if(typeof options.sslValidate == 'boolean') finalOptions.rejectUnauthorized = options.sslValidate;
if(options.sslKey) finalOptions.key = options.sslKey;
if(options.sslCert) finalOptions.cert = options.sslCert;
if(options.sslPass) finalOptions.passphrase = options.sslPass;
if(options.checkServerIdentity) finalOptions.checkServerIdentity = options.checkServerIdentity;
// Create the ReplSet
var replset = new CReplSet(seedlist, finalOptions)
// Server capabilities
var sCapabilities = null;
// Listen to reconnect event
replset.on('reconnect', function() {
self.emit('reconnect');
store.execute();
});
// Internal state
this.s = {
// Replicaset
replset: replset
// Server capabilities
, sCapabilities: null
// Debug tag
if(options.connectWithNoPrimary == true) {
finalOptions.secondaryOnlyConnectionAllowed = true;
}
// Add the non connection store
finalOptions.disconnectHandler = store;
// Translate the options
if(options.sslCA) finalOptions.ca = options.sslCA;
if(typeof options.sslValidate == 'boolean') finalOptions.rejectUnauthorized = options.sslValidate;
if(options.sslKey) finalOptions.key = options.sslKey;
if(options.sslCert) finalOptions.cert = options.sslCert;
if(options.sslPass) finalOptions.passphrase = options.sslPass;
// Create the ReplSet
var replset = new CReplSet(seedlist, finalOptions)
// Server capabilities
var sCapabilities = null;
// Add auth prbufferMaxEntriesoviders
replset.addAuthProvider('mongocr', new MongoCR());
// Listen to reconnect event
replset.on('reconnect', function() {
self.emit('reconnect');
store.execute();
});
// Internal state
this.s = {
// Replicaset
replset: replset
// Server capabilities
name: name,
architecture: architecture,
version: release
},
platform: nodejsversion
}
// Build default client information
clonedOptions.clientInfo = this.clientInfo;
// Do we have an application specific string
if(options.appname) {
clonedOptions.clientInfo.application = { name: options.appname };
}
// Create the ReplSet
var replset = new CReplSet(seedlist, clonedOptions);
// Listen to reconnect event
replset.on('reconnect', function() {
self.emit('reconnect');
store.execute();
});
// Internal state
this.s = {
// Replicaset
replset: replset
// Server capabilities
, sCapabilities: null
// Debug tag
, tag: options.tag
// Store options