Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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

Tree House
Tree House
19,702 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
21,058 Points

check if you mango db is runing with show dbs

Tree House
Tree House
19,702 Points

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