How to fix «current Server Discovery and Monitoring engine is deprecated» on a MongoDB connection using the `mongodb` Node.js package?

03

(node:20316) DeprecationWarning: 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 the MongoClient constructor.

I have fixed it by adding the {useUnifiedTopology: true} connection parameter.
So I replaced:


with: