@@ -38,7 +38,7 @@ var validOptionNames = ['poolSize', 'ssl', 'sslValidate', 'sslCA', 'sslCert',
38
38
'serializeFunctions' , 'ignoreUndefined' , 'raw' , 'promoteLongs' , 'bufferMaxEntries' ,
39
39
'readPreference' , 'pkFactory' , 'promiseLibrary' , 'readConcern' , 'maxStalenessSeconds' ,
40
40
'loggerLevel' , 'logger' , 'promoteValues' , 'promoteBuffers' , 'promoteLongs' ,
41
- 'domainsEnabled' , 'keepAliveInitialDelay' , 'checkServerIdentity' , 'validateOptions' , 'appname' ] ;
41
+ 'domainsEnabled' , 'keepAliveInitialDelay' , 'checkServerIdentity' , 'validateOptions' , 'appname' , 'auth' ] ;
42
42
var ignoreOptionNames = [ 'native_parser' ] ;
43
43
var legacyOptionNames = [ 'server' , 'replset' , 'replSet' , 'mongos' , 'db' ] ;
44
44
@@ -114,6 +114,8 @@ function MongoClient() {
114
114
* @param {number } [options.acceptableLatencyMS=15] Cutoff latency point in MS for Mongos proxies selection.
115
115
* @param {boolean } [options.connectWithNoPrimary=false] Sets if the driver should connect even if no primary is available
116
116
* @param {string } [options.authSource=undefined] Define the database to authenticate against
117
+ * @param {string } [options.auth.user=undefined] The username for auth
118
+ * @param {string } [options.auth.password=undefined] The username for auth
117
119
* @param {(number|string) } [options.w=null] The write concern.
118
120
* @param {number } [options.wtimeout=null] The write concern timeout.
119
121
* @param {boolean } [options.j=false] Specify a journal write concern.
@@ -183,6 +185,8 @@ var define = MongoClient.define = new Define('MongoClient', MongoClient, false);
183
185
* @param {number } [options.acceptableLatencyMS=15] Cutoff latency point in MS for Mongos proxies selection.
184
186
* @param {boolean } [options.connectWithNoPrimary=false] Sets if the driver should connect even if no primary is available
185
187
* @param {string } [options.authSource=undefined] Define the database to authenticate against
188
+ * @param {string } [options.auth.user=undefined] The username for auth
189
+ * @param {string } [options.auth.password=undefined] The username for auth
186
190
* @param {(number|string) } [options.w=null] The write concern.
187
191
* @param {number } [options.wtimeout=null] The write concern timeout.
188
192
* @param {boolean } [options.j=false] Specify a journal write concern.
@@ -488,6 +492,10 @@ var connect = function(self, url, options, callback) {
488
492
if ( _finalOptions . socketTimeoutMS == null ) _finalOptions . socketTimeoutMS = 360000 ;
489
493
if ( _finalOptions . connectTimeoutMS == null ) _finalOptions . connectTimeoutMS = 30000 ;
490
494
495
+ if ( _finalOptions . db_options && _finalOptions . db_options . auth ) {
496
+ delete _finalOptions . db_options . auth ;
497
+ }
498
+
491
499
// Failure modes
492
500
if ( object . servers . length == 0 ) {
493
501
throw new Error ( "connection string must contain at least one seed host" ) ;
0 commit comments