I have a similar situation to yours:

winston.add(
  new winston.transports.MongoDB({
    level: 'info',
    db: process.env.DATABASE,
    collection: 'info_logs',
    options: {
      useUnifiedTopology: true,
    },
  })
);

But I had the error:
[DEP0170] DeprecationWarning: The URL mongodb://<USERNAME>:<PASSWORD>@ac-4hlp44x-shard-00-01.nqjamzn.mongodb.net:27017,ac-4hlp44x-shard-00-02.nqjamzn.mongodb.net:27017,ac-4hlp44x-shard-00-00.nqjamzn.mongodb.net:27017/<DATABASE>?authSource=admin&replicaSet=atlas-g8a2vr-shard-0&retryWrites=true&w=majority&ssl=true is invalid. Future versions of Node.js will throw an error.

1 Like