From 814a4cccda1a6f406500dd1a092f725e4ca57308 Mon Sep 17 00:00:00 2001 From: Dan Aprahamian Date: Tue, 13 Aug 2019 10:31:13 -0400 Subject: [PATCH] chore(useUnifiedTopology): add deprecation warning for useUnifiedTopology --- lib/operations/connect.js | 5 +++++ 1 file changed, 5 insertions(+) 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);