I am using mongoose to connect the MongoDB with my backend.
const connectDB = async () => { try { const conn = await mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true, });
This is the piece of code I wrote and it has 2 warning: "Warning: useNewUrlParser is a deprecated option" and "Warning: useUnifiedTopology is a deprecated option". Is there a way to fix them?
I tried installing version <4.0 but same error is picking up.
Simply remove it. Your code should look like this