JavaScript User Authentication With Express and Mongo User Registration Setting Up Mongoose and a Mongo Database

Ihsan Rabbani
Ihsan Rabbani
16,165 Points

error starting on windows

i got still get the error after start a mongodb server

[nodemon] starting node ./app (node:16676) 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.

3 Answers

Check your mongo version

mongo --version If you are using version >= 3.1.0 change you 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 is supporting it too. Check out MongoDB Github for details.

HIDAYATULLAH ARGHANDABI
HIDAYATULLAH ARGHANDABI
20,982 Points

check if you mango db is runing with show dbs

Ihsan Rabbani
Ihsan Rabbani
16,165 Points

thanks for helping! my mongo version 4.0 so i have to add { useNewUrlParser: true } and it work fine after that.