Skip to content

Commit

Permalink
feat: remove legacy topology types
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst committed Mar 9, 2020
1 parent ade9a62 commit 6aa2434
Show file tree
Hide file tree
Showing 143 changed files with 171 additions and 10,094 deletions.
4 changes: 0 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ connect.Admin = require('./lib/admin');
connect.MongoClient = require('./lib/mongo_client');
connect.Db = require('./lib/db');
connect.Collection = require('./lib/collection');
connect.Server = require('./lib/topologies/server');
connect.ReplSet = require('./lib/topologies/replset');
connect.Mongos = require('./lib/topologies/mongos');
connect.ReadPreference = core.ReadPreference;
connect.GridStore = require('./lib/gridfs/grid_store');
connect.Chunk = require('./lib/gridfs/chunk');
Expand All @@ -34,7 +31,6 @@ connect.CommandCursor = require('./lib/command_cursor');
connect.Cursor = require('./lib/cursor');
connect.GridFSBucket = require('./lib/gridfs-stream');
// Exported to be used in tests not to be used anywhere else
connect.CoreServer = core.Server;
connect.CoreConnection = core.Connection;

// BSON types exported
Expand Down
8 changes: 5 additions & 3 deletions lib/core/uri_parser.js → lib/connection_string.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
const URL = require('url');
const qs = require('querystring');
const dns = require('dns');
const MongoParseError = require('./error').MongoParseError;
const ReadPreference = require('./topologies/read_preference');
const MongoParseError = require('./core/error').MongoParseError;
const ReadPreference = require('./core/topologies/read_preference');

/**
* The following regular expression validates a connection string and breaks the
Expand Down Expand Up @@ -698,4 +698,6 @@ function parseConnectionString(uri, options, callback) {
callback(null, result);
}

module.exports = parseConnectionString;
module.exports = {
parseConnectionString
};
3 changes: 1 addition & 2 deletions lib/core/cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const MongoNetworkError = require('./error').MongoNetworkError;
const mongoErrorContextSymbol = require('./error').mongoErrorContextSymbol;
const collationNotSupported = require('./utils').collationNotSupported;
const ReadPreference = require('./topologies/read_preference');
const isUnifiedTopology = require('./utils').isUnifiedTopology;
const executeOperation = require('../operations/execute_operation');
const Readable = require('stream').Readable;
const SUPPORTS = require('../utils').SUPPORTS;
Expand Down Expand Up @@ -428,7 +427,7 @@ class CoreCursor extends Readable {
const cursor = this;

// NOTE: this goes away once cursors use `executeOperation`
if (isUnifiedTopology(cursor.topology) && cursor.topology.shouldCheckForSessionSupport()) {
if (cursor.topology.shouldCheckForSessionSupport()) {
cursor.topology.selectServer(ReadPreference.primaryPreferred, err => {
if (err) {
callback(err);
Expand Down
7 changes: 1 addition & 6 deletions lib/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ module.exports = {
mongoErrorContextSymbol: require('./error').mongoErrorContextSymbol,
// Core
Connection: require('./connection/connection'),
Server: require('./topologies/server'),
ReplSet: require('./topologies/replset'),
Mongos: require('./topologies/mongos'),
Logger: require('./connection/logger'),
Cursor: require('./cursor').CoreCursor,
ReadPreference: require('./topologies/read_preference'),
Expand All @@ -45,7 +42,5 @@ module.exports = {
Plain: require('./auth/plain'),
GSSAPI: require('./auth/gssapi'),
ScramSHA1: require('./auth/scram').ScramSHA1,
ScramSHA256: require('./auth/scram').ScramSHA256,
// Utilities
parseConnectionString: require('./uri_parser')
ScramSHA256: require('./auth/scram').ScramSHA256
};
Loading

0 comments on commit 6aa2434

Please sign in to comment.