Skip to content

Commit

Permalink
chore(useUnifiedTopology): add deprecation warning for useUnifiedTopo…
Browse files Browse the repository at this point in the history
…logy
  • Loading branch information
daprahamian committed Aug 13, 2019
1 parent b7308db commit 814a4cc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/operations/connect.js
Expand Up @@ -241,6 +241,9 @@ function collectEvents(mongoClient, topology) {
return collectedEvents;
}

const emitDeprecationForNonUnifiedTopology = deprecate(() => {},
'current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. ' + 'To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to MongoClient.connect.');

function connect(mongoClient, url, options, callback) {
options = Object.assign({}, options);

Expand Down Expand Up @@ -306,6 +309,8 @@ function connect(mongoClient, url, options, callback) {
return createTopology(mongoClient, 'unified', _finalOptions, connectCallback);
}

emitDeprecationForNonUnifiedTopology();

// Do we have a replicaset then skip discovery and go straight to connectivity
if (_finalOptions.replicaSet || _finalOptions.rs_name) {
return createTopology(mongoClient, 'replicaset', _finalOptions, connectCallback);
Expand Down

0 comments on commit 814a4cc

Please sign in to comment.