Skip to content

Commit

Permalink
refactor(topology-base): getServer => selectServer
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst committed Aug 13, 2018
1 parent b33fc74 commit ff5fafc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
9 changes: 3 additions & 6 deletions lib/bulk/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -696,14 +696,11 @@ class BulkOperationBase {
const bson = topology.bson;

// Set max byte size
const isMaster = topology.lastIsMaster();
const maxBatchSizeBytes =
topology.isMasterDoc && topology.isMasterDoc.maxBsonObjectSize
? topology.isMasterDoc.maxBsonObjectSize
: 1024 * 1024 * 16;
isMaster && isMaster.maxBsonObjectSize ? isMaster.maxBsonObjectSize : 1024 * 1024 * 16;
const maxWriteBatchSize =
topology.isMasterDoc && topology.isMasterDoc.maxWriteBatchSize
? topology.isMasterDoc.maxWriteBatchSize
: 1000;
isMaster && isMaster.maxWriteBatchSize ? isMaster.maxWriteBatchSize : 1000;

// Get the write concern
let writeConcern = applyWriteConcern(
Expand Down
15 changes: 2 additions & 13 deletions lib/topologies/topology_base.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,8 @@ class TopologyBase extends EventEmitter {
return this.s.coreTopology.lastIsMaster();
}

getServer(options) {
return this.s.coreTopology.getServer(options);
}

getConnection(options) {
return this.s.coreTopology.getConnection(options);
selectServer(selector, options, callback) {
return this.s.coreTopology.selectServer(selector, options, callback);
}

/**
Expand Down Expand Up @@ -417,13 +413,6 @@ class TopologyBase extends EventEmitter {
}

// Properties
Object.defineProperty(TopologyBase.prototype, 'isMasterDoc', {
enumerable: true,
get: function() {
return this.s.coreTopology.lastIsMaster();
}
});

Object.defineProperty(TopologyBase.prototype, 'bson', {
enumerable: true,
get: function() {
Expand Down

0 comments on commit ff5fafc

Please sign in to comment.