Avoid “current URL string parser is deprecated” warning by setting useNewUrlParser to true

Check your mongo version:

mongo --version

If you are using version >= 3.1.0, change your mongo connection file to ->

MongoClient.connect("mongodb://localhost:27017/YourDB", { useNewUrlParser: true })

or your mongoose connection file to ->

mongoose.connect("mongodb://localhost:27017/YourDB", { useNewUrlParser: true });

Ideally, it’s a version 4 feature, but v3.1.0 and above are supporting it too. Check out MongoDB GitHub for details.

Leave a Comment