Skip to content

Commit ff5fafc

Browse files
committed
refactor(topology-base): getServer => selectServer
1 parent b33fc74 commit ff5fafc

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

lib/bulk/common.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -696,14 +696,11 @@ class BulkOperationBase {
696696
const bson = topology.bson;
697697

698698
// Set max byte size
699+
const isMaster = topology.lastIsMaster();
699700
const maxBatchSizeBytes =
700-
topology.isMasterDoc && topology.isMasterDoc.maxBsonObjectSize
701-
? topology.isMasterDoc.maxBsonObjectSize
702-
: 1024 * 1024 * 16;
701+
isMaster && isMaster.maxBsonObjectSize ? isMaster.maxBsonObjectSize : 1024 * 1024 * 16;
703702
const maxWriteBatchSize =
704-
topology.isMasterDoc && topology.isMasterDoc.maxWriteBatchSize
705-
? topology.isMasterDoc.maxWriteBatchSize
706-
: 1000;
703+
isMaster && isMaster.maxWriteBatchSize ? isMaster.maxWriteBatchSize : 1000;
707704

708705
// Get the write concern
709706
let writeConcern = applyWriteConcern(

lib/topologies/topology_base.js

+2-13
Original file line numberDiff line numberDiff line change
@@ -358,12 +358,8 @@ class TopologyBase extends EventEmitter {
358358
return this.s.coreTopology.lastIsMaster();
359359
}
360360

361-
getServer(options) {
362-
return this.s.coreTopology.getServer(options);
363-
}
364-
365-
getConnection(options) {
366-
return this.s.coreTopology.getConnection(options);
361+
selectServer(selector, options, callback) {
362+
return this.s.coreTopology.selectServer(selector, options, callback);
367363
}
368364

369365
/**
@@ -417,13 +413,6 @@ class TopologyBase extends EventEmitter {
417413
}
418414

419415
// Properties
420-
Object.defineProperty(TopologyBase.prototype, 'isMasterDoc', {
421-
enumerable: true,
422-
get: function() {
423-
return this.s.coreTopology.lastIsMaster();
424-
}
425-
});
426-
427416
Object.defineProperty(TopologyBase.prototype, 'bson', {
428417
enumerable: true,
429418
get: function() {

0 commit comments

Comments
 (0)