Current URL string parser is deprecated

  • A+
Category:Languages

when I run the code by "node app.js" command this error is showing

(node:2509) 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.

 


You need to pass { useNewUrlParser: true } option to mongoose.connect() method. Your code should look similar to the snippet below.

mongoose.connect('mongodb://user:pw@host1.com:27017/dbname', { useNewUrlParser: true }) 

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: