Mongoose.connect deprecation warning

Hello guys, I get this error trying to connect to my Mongo DB. how can I solve this issue?

(node:3672) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true
} to MongoClient.connect.

1 Like

Pass {useNewUrlParser: true} to mongoose.connect().

mongoose.connect('mongodb://url/to/db', {useNewUrlParser: true});
2 Likes