diff --git a/lib/operations/connect.js b/lib/operations/connect.js index 897588d959..9091c21f88 100644 --- a/lib/operations/connect.js +++ b/lib/operations/connect.js @@ -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); @@ -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);