Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
options.promiseLibrary = promiseLibrary;
// var self = this; // Internal state of the db object
this.s = {
// Database name
databaseName: databaseName
// DbCache
, dbCache: {}
// Children db's
, children: []
// Topology
, topology: topology
// Options
, options: options
// Logger instance
, logger: Logger('Db', options)
// Get the bson parser
, bson: topology ? topology.bson : null
// Authsource if any
, authSource: options.authSource
// Unpack read preference
, readPreference: options.readPreference
// Set buffermaxEntries
, bufferMaxEntries: typeof options.bufferMaxEntries == 'number' ? options.bufferMaxEntries : -1
// Parent db (if chained)
, parentDb: options.parentDb || null
// Set up the primary key factory or fallback to ObjectID
, pkFactory: options.pkFactory || ObjectID
// Get native parser
, nativeParser: options.nativeParser || options.native_parser
// Promise library
, promiseLibrary: promiseLibrary
options.promiseLibrary = promiseLibrary;
// var self = this; // Internal state of the db object
this.s = {
// Database name
databaseName: databaseName
// DbCache
, dbCache: {}
// Children db's
, children: []
// Topology
, topology: topology
// Options
, options: options
// Logger instance
, logger: Logger('Db', options)
// Get the bson parser
, bson: topology ? topology.bson : null
// Authsource if any
, authSource: options.authSource
// Unpack read preference
, readPreference: options.readPreference
// Set buffermaxEntries
, bufferMaxEntries: typeof options.bufferMaxEntries == 'number' ? options.bufferMaxEntries : -1
// Parent db (if chained)
, parentDb: options.parentDb || null
// Set up the primary key factory or fallback to ObjectID
, pkFactory: options.pkFactory || ObjectID
// Get native parser
, nativeParser: options.nativeParser || options.native_parser
// Promise library
, promiseLibrary: promiseLibrary
var connect = function(self, url, options, callback) {
options = options || {};
options = shallowClone(options);
// If callback is null throw an exception
if(callback == null) {
throw new Error("no callback function provided");
}
// Get a logger for MongoClient
var logger = Logger('MongoClient', options);
// Parse the string
var object = parse(url, options);
var _finalOptions = createUnifiedOptions({}, object);
_finalOptions = mergeOptions(_finalOptions, object, false);
_finalOptions = createUnifiedOptions(_finalOptions, options);
// Check if we have connection and socket timeout set
if(_finalOptions.socketTimeoutMS == null) _finalOptions.socketTimeoutMS = 360000;
if(_finalOptions.connectTimeoutMS == null) _finalOptions.connectTimeoutMS = 30000;
if (_finalOptions.db_options && _finalOptions.db_options.auth) {
delete _finalOptions.db_options.auth;
}
// Failure modes
options.promiseLibrary = promiseLibrary;
// var self = this; // Internal state of the db object
this.s = {
// Database name
databaseName: databaseName
// DbCache
, dbCache: {}
// Children db's
, children: []
// Topology
, topology: topology
// Options
, options: options
// Logger instance
, logger: Logger('Db', options)
// Get the bson parser
, bson: topology ? topology.bson : null
// Authsource if any
, authSource: options.authSource
// Unpack read preference
, readPreference: options.readPreference
// Set buffermaxEntries
, bufferMaxEntries: typeof options.bufferMaxEntries == 'number' ? options.bufferMaxEntries : -1
// Parent db (if chained)
, parentDb: options.parentDb || null
// Set up the primary key factory or fallback to ObjectID
, pkFactory: options.pkFactory || ObjectID
// Get native parser
, nativeParser: options.nativeParser || options.native_parser
// Promise library
, promiseLibrary: promiseLibrary
var connect = function(self, url, options, callback) {
options = options || {};
options = shallowClone(options);
// If callback is null throw an exception
if(callback == null) {
throw new Error("no callback function provided");
}
// Get a logger for MongoClient
var logger = Logger('MongoClient', options);
// Parse the string
var object = parse(url, options);
var _finalOptions = createUnifiedOptions({}, object);
_finalOptions = mergeOptions(_finalOptions, object, false);
_finalOptions = createUnifiedOptions(_finalOptions, options);
// Check if we have connection and socket timeout set
if(_finalOptions.socketTimeoutMS == null) _finalOptions.socketTimeoutMS = 30000;
if(_finalOptions.connectTimeoutMS == null) _finalOptions.connectTimeoutMS = 30000;
// Failure modes
if(object.servers.length == 0) {
throw new Error("connection string must contain at least one seed host");
}
options.promiseLibrary = promiseLibrary;
// var self = this; // Internal state of the db object
this.s = {
// Database name
databaseName: databaseName
// DbCache
, dbCache: {}
// Children db's
, children: []
// Topology
, topology: topology
// Options
, options: options
// Logger instance
, logger: Logger('Db', options)
// Get the bson parser
, bson: topology ? topology.bson : null
// Authsource if any
, authSource: options.authSource
// Unpack read preference
, readPreference: options.readPreference
// Set buffermaxEntries
, bufferMaxEntries: typeof options.bufferMaxEntries == 'number' ? options.bufferMaxEntries : -1
// Parent db (if chained)
, parentDb: options.parentDb || null
// Set up the primary key factory or fallback to ObjectID
, pkFactory: options.pkFactory || ObjectID
// Get native parser
, nativeParser: options.nativeParser || options.native_parser
// Promise library
, promiseLibrary: promiseLibrary
var connect = function(url, options, callback) {
options = options || {};
options = shallowClone(options);
// If callback is null throw an exception
if(callback == null) {
throw new Error("no callback function provided");
}
// Get a logger for MongoClient
var logger = Logger('MongoClient', options);
// Parse the string
var object = parse(url, options);
var _finalOptions = createUnifiedOptions({}, object);
_finalOptions = mergeOptions(_finalOptions, object, false);
_finalOptions = createUnifiedOptions(_finalOptions, options);
// Check if we have connection and socket timeout set
if(_finalOptions.socketTimeoutMS == null) _finalOptions.socketTimeoutMS = 30000;
if(_finalOptions.connectTimeoutMS == null) _finalOptions.connectTimeoutMS = 30000;
// Failure modes
if(object.servers.length == 0) {
throw new Error("connection string must contain at least one seed host");
}
options.promiseLibrary = promiseLibrary;
// var self = this; // Internal state of the db object
this.s = {
// Database name
databaseName: databaseName
// DbCache
, dbCache: {}
// Children db's
, children: []
// Topology
, topology: topology
// Options
, options: options
// Logger instance
, logger: Logger('Db', options)
// Get the bson parser
, bson: topology ? topology.bson : null
// Authsource if any
, authSource: options.authSource
// Unpack read preference
, readPreference: options.readPreference
// Set buffermaxEntries
, bufferMaxEntries: typeof options.bufferMaxEntries == 'number' ? options.bufferMaxEntries : -1
// Parent db (if chained)
, parentDb: options.parentDb || null
// Set up the primary key factory or fallback to ObjectID
, pkFactory: options.pkFactory || ObjectID
// Get native parser
, nativeParser: options.nativeParser || options.native_parser
// Promise library
, promiseLibrary: promiseLibrary
options.promiseLibrary = promiseLibrary;
// Internal state of the db object
this.s = {
// Database name
databaseName: databaseName,
// DbCache
dbCache: {},
// Children db's
children: [],
// Topology
topology: topology,
// Options
options: options,
// Logger instance
logger: Logger('Db', options),
// Get the bson parser
bson: topology ? topology.bson : null,
// Unpack read preference
readPreference: options.readPreference,
// Set buffermaxEntries
bufferMaxEntries: typeof options.bufferMaxEntries === 'number' ? options.bufferMaxEntries : -1,
// Parent db (if chained)
parentDb: options.parentDb || null,
// Set up the primary key factory or fallback to ObjectID
pkFactory: options.pkFactory || ObjectID,
// Get native parser
nativeParser: options.nativeParser || options.native_parser,
// Promise library
promiseLibrary: promiseLibrary,
// No listener
noListener: typeof options.noListener === 'boolean' ? options.noListener : false,