I'm trying to connect my NodeJS project to mongoose by using this statement :-
var mongoose = require("mongoose");
mongoose.connect('mongodb://localhost:27017/football', {useNewUrlParser: true});
However on running the given .js file I am getting the following error :-
(node:3438) 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 tried adding {useUnifiedTopology : true} to the parameters, but then it shows error for having 3 arguments
How to solve this problem
mongoose.connect('mongodb://localhost:27017/football', { useNewUrlParser: true, useUnifiedTopology: true });
– Arif Khan