@@ -272,7 +272,6 @@ class Topology extends EventEmitter {
272
272
273
273
translateReadPreference ( options ) ;
274
274
const readPreference = options . readPreference || ReadPreference . primary ;
275
-
276
275
this . selectServer ( readPreferenceServerSelector ( readPreference ) , options , ( err , server ) => {
277
276
if ( err ) {
278
277
stateTransition ( this , STATE_CLOSED ) ;
@@ -420,7 +419,7 @@ class Topology extends EventEmitter {
420
419
const transaction = session && session . transaction ;
421
420
422
421
if ( isSharded && transaction && transaction . server ) {
423
- callback ( null , transaction . server ) ;
422
+ callback ( undefined , transaction . server ) ;
424
423
return ;
425
424
}
426
425
@@ -434,14 +433,14 @@ class Topology extends EventEmitter {
434
433
options . serverSelectionTimeoutMS ,
435
434
process . hrtime ( ) ,
436
435
( err , servers ) => {
437
- if ( err ) return callback ( err , null ) ;
436
+ if ( err ) return callback ( err ) ;
438
437
439
438
const selectedServer = randomSelection ( servers ) ;
440
439
if ( isSharded && transaction && transaction . isActive ) {
441
440
transaction . pinServer ( selectedServer ) ;
442
441
}
443
442
444
- callback ( null , selectedServer ) ;
443
+ callback ( undefined , selectedServer ) ;
445
444
}
446
445
) ;
447
446
}
@@ -564,11 +563,11 @@ class Topology extends EventEmitter {
564
563
565
564
auth ( credentials , callback ) {
566
565
if ( typeof credentials === 'function' ) ( callback = credentials ) , ( credentials = null ) ;
567
- if ( typeof callback === 'function' ) callback ( null , true ) ;
566
+ if ( typeof callback === 'function' ) callback ( undefined , true ) ;
568
567
}
569
568
570
569
logout ( callback ) {
571
- if ( typeof callback === 'function' ) callback ( null , true ) ;
570
+ if ( typeof callback === 'function' ) callback ( undefined , true ) ;
572
571
}
573
572
574
573
// Basic operation support. Eventually this should be moved into command construction
@@ -648,7 +647,7 @@ class Topology extends EventEmitter {
648
647
649
648
this . selectServer ( readPreferenceServerSelector ( readPreference ) , options , ( err , server ) => {
650
649
if ( err ) {
651
- callback ( err , null ) ;
650
+ callback ( err ) ;
652
651
return ;
653
652
}
654
653
@@ -661,7 +660,7 @@ class Topology extends EventEmitter {
661
660
isWriteCommand ( cmd ) ;
662
661
663
662
const cb = ( err , result ) => {
664
- if ( ! err ) return callback ( null , result ) ;
663
+ if ( ! err ) return callback ( undefined , result ) ;
665
664
if ( ! isRetryableError ( err ) ) {
666
665
return callback ( err ) ;
667
666
}
0 commit comments