Skip to content

Commit aa1a32c

Browse files
committed
refactor(sdam): null => undefined
1 parent 8a534bb commit aa1a32c

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

lib/core/sdam/topology.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ class Topology extends EventEmitter {
272272

273273
translateReadPreference(options);
274274
const readPreference = options.readPreference || ReadPreference.primary;
275-
276275
this.selectServer(readPreferenceServerSelector(readPreference), options, (err, server) => {
277276
if (err) {
278277
stateTransition(this, STATE_CLOSED);
@@ -420,7 +419,7 @@ class Topology extends EventEmitter {
420419
const transaction = session && session.transaction;
421420

422421
if (isSharded && transaction && transaction.server) {
423-
callback(null, transaction.server);
422+
callback(undefined, transaction.server);
424423
return;
425424
}
426425

@@ -434,14 +433,14 @@ class Topology extends EventEmitter {
434433
options.serverSelectionTimeoutMS,
435434
process.hrtime(),
436435
(err, servers) => {
437-
if (err) return callback(err, null);
436+
if (err) return callback(err);
438437

439438
const selectedServer = randomSelection(servers);
440439
if (isSharded && transaction && transaction.isActive) {
441440
transaction.pinServer(selectedServer);
442441
}
443442

444-
callback(null, selectedServer);
443+
callback(undefined, selectedServer);
445444
}
446445
);
447446
}
@@ -564,11 +563,11 @@ class Topology extends EventEmitter {
564563

565564
auth(credentials, callback) {
566565
if (typeof credentials === 'function') (callback = credentials), (credentials = null);
567-
if (typeof callback === 'function') callback(null, true);
566+
if (typeof callback === 'function') callback(undefined, true);
568567
}
569568

570569
logout(callback) {
571-
if (typeof callback === 'function') callback(null, true);
570+
if (typeof callback === 'function') callback(undefined, true);
572571
}
573572

574573
// Basic operation support. Eventually this should be moved into command construction
@@ -648,7 +647,7 @@ class Topology extends EventEmitter {
648647

649648
this.selectServer(readPreferenceServerSelector(readPreference), options, (err, server) => {
650649
if (err) {
651-
callback(err, null);
650+
callback(err);
652651
return;
653652
}
654653

@@ -661,7 +660,7 @@ class Topology extends EventEmitter {
661660
isWriteCommand(cmd);
662661

663662
const cb = (err, result) => {
664-
if (!err) return callback(null, result);
663+
if (!err) return callback(undefined, result);
665664
if (!isRetryableError(err)) {
666665
return callback(err);
667666
}

0 commit comments

Comments
 (0)