Exercise tracker project - I cant connect MongoDB

what’s happening:
when I run server.js, DeprecationWarning happens like bellow.

(node:140) DeprecationWarning: open() is deprecated in mongoose >= 4.11.0, use openUri() instead, or set the useMongoClient option if using connect() or createConnection(). See http://mongoosejs.com/docs/4.x/docs/connections.html#use-mongo-client

I cant connect MongoDB and I dont understand what do I do.
In previous project (url-shortner), I connected MongoDB by same code.

I cant understand what difference cause for this error.
please tell me why this happens.
Thanks.

Your code so far

const mongoose = require('mongoose')
mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true });
var db = mongoose.connection

db.on('error', console.error.bind(console, 'connect error:'));
db.once('open', function() {
    console.log('connect success');
})

Your browser information:

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0.

Challenge: Exercise Tracker

Link to the challenge:

Welcome, kajisun.

Why do you have this code:

db.on('error', console.error.bind(console, 'connect error:'));
db.once('open', function() {
    console.log('connect success');
})

Also, could you provide a link to your project? There might be other variables at play.

Thanks for your reply.

This link is my project.

The purpose of this code is to check the connection to the database.

db.on('error', console.error.bind(console, 'connect error:'));
db.once('open', function() {
    console.log('connect success');
})

I resolved this issue.

MongoDB and Mongoose packages was old version.
So I updated these packages.

Thanks!!