I cannot get rid of the warning. My code:
const MongoClient = require('mongodb').MongoClient;
let app = {};
const config = require('../config')(app);
const appl = async() => {
const url = config.dbConnector;
console.log(url);
const client = new MongoClient(url, {
useUnifiedTopology: true,
});
await client.connect();
const db = client.db('zcloud');
const appusers = await db.collection('AppUser').find().toArray();
appusers.forEach((u) => {
console.log(u.userId);
});
}
appl().then(() => {
process.exit(0);
}).catch((err) => {
console.log(err);
process.exit(1);
});
I get
(node:87168) 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.