Skip to content

Commit 814a4cc

Browse files
committed
chore(useUnifiedTopology): add deprecation warning for useUnifiedTopology
1 parent b7308db commit 814a4cc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/operations/connect.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ function collectEvents(mongoClient, topology) {
241241
return collectedEvents;
242242
}
243243

244+
const emitDeprecationForNonUnifiedTopology = deprecate(() => {},
245+
'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.');
246+
244247
function connect(mongoClient, url, options, callback) {
245248
options = Object.assign({}, options);
246249

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

312+
emitDeprecationForNonUnifiedTopology();
313+
309314
// Do we have a replicaset then skip discovery and go straight to connectivity
310315
if (_finalOptions.replicaSet || _finalOptions.rs_name) {
311316
return createTopology(mongoClient, 'replicaset', _finalOptions, connectCallback);

0 commit comments

Comments
 (0)