MongoDB driver warning

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.
(Use node --trace-warnings ... to show where the warning was created)

My code in db.js

const mongoose = require(‘mongoose’);
const winston = require(‘winston’);
const config = require(‘config’);

module.exports = function() {
const db = config.get(‘db’);
mongoose.connect(db, { useNewUrlParser: true, useUnifiedTopology: true })
.then(() => winston.info(Connected to ${db}...));
}

My code in logging.js

const winston = require(‘winston’);
require(‘winston-mongodb’);
require(‘express-async-errors’);
const config = require(‘config’);

module.exports = function() {
winston.exceptions.handle(
new winston.transports.Console({ colorize: true, prettyPrint: true }),
new winston.transports.File({filename: ‘uncaughtExceptions.log’})
);

process.on('unhandledRejection', (ex) => {
    throw ex;
});

winston.add(
    new winston.transports.MongoDB({
      db: 'mongodb://localhost/vidly',
      level: 'error',
      options: { useUnifiedTopology: true },
    })
  );    
winston.add(new winston.transports.File({filename: 'logfile.log'}));
winston.add(new winston.transports.MongoDB({
    db: 'mongodb://localhost/vidly',
    level: 'info'
}));

}

Please note I am using mongoose and not MongoClient anywhere

winston.info(Connected to ${db}...));

should be

winston.info(`Connected to ${db}...`));

it is:
winston.info(Connected to ${db}...));

it is just not showing in here

what version of Winston you’re using? is it the latest?

if you’ve reading the documentation of the latest Winston. The recommended way to use winston is to create your own logger. The simplest way to do this is using winston.createLogger

Ok, and after creating the logger can you please help me with the next steps?

here is how I define my logger

const { createLogger, format, transports } = require("winston");
const { combine, timestamp, printf, simple } = format;
// require("winston-mongodb");

const logFormat = printf(({ level, message, timestamp }) => {
  return `${level}: ${timestamp} ${message}`;
});

const logger = createLogger({
  transports: [
    new transports.Console({
      level: "debug",
      handleExceptions: true,
      handleRejections: true,
      format: simple(),
    }),
    new transports.File({
      level: "info",
      filename: "loginfo.log",
      format: simple(),
    }),
    new transports.File({
      level: "error",
      filename: "exception.log",
      handleExceptions: true,
      handleRejections: true,
      format: combine(timestamp({ format: "DD/MM/YYYY HH:mm:ss" }), logFormat),
    }),
  ],
});

module.exports = logger;
module.exports.stream = {
  write: function (message) {
    logger.info(message.replace(/(\r\n|\n|\r)/gm, ""));
  },
};

Thanks did the same but still facing the above issue