DEV Community

Cover image for Warning: Current Server Discovery and Monitoring engine
Robiul
Robiul

Posted on

Warning: Current Server Discovery and Monitoring engine

[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.

Using the Winston to write the MongoDB logger. we have to pass everything which is required for MongoDB.
If we mistake anything it will make an error

If you use your project Winston logger and you did not pass options into the Winston transport that's why you get the error.

Following this.
The error will be gone.

winston.add(new winston.transports.MongoDB({
    db: 'mongodb://localhost:27017/',
    options: {
        useUnifiedTopology: true,
    }
}));
Enter fullscreen mode Exit fullscreen mode

Top comments (0)