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

(node:7288) DeprecationWarning:


When following along I received this error:

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

I googled it and made this change:

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

Error went away, hope this helps others.

Thanks! I was just about to look this up as well.

2 Answers

Ryan Doran
Ryan Doran
7,815 Points

The new documentation requires another addition as well: {useUnifiedTopology: true}

mongoose.connect("mongodb://localhost:27017/bookworm", { 
    useNewUrlParser: true, 
    useUnifiedTopology: true 
Roger Rodriguez
Roger Rodriguez
9,353 Points

Good catch while going through this videos is also a good idea to have the latest documentation of the packages in npmjs.com.

there you can see the solution directly from the documentation.