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 trialDaniel Baker
15,369 Points(node:7288) DeprecationWarning:
https://teamtreehouse.com/library/setting-up-mongoose-and-a-mongo-database
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.
Jeff Au
7,022 PointsThanks! I was just about to look this up as well.
2 Answers
Ryan Doran
7,815 PointsThe new documentation requires another addition as well: {useUnifiedTopology: true}
mongoose.connect("mongodb://localhost:27017/bookworm", {
useNewUrlParser: true,
useUnifiedTopology: true
});
Roger Rodriguez
9,353 PointsGood 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.
cheers.
Daniel Totten
Full Stack JavaScript Techdegree Graduate 21,008 PointsDaniel Totten
Full Stack JavaScript Techdegree Graduate 21,008 PointsThanks, same happened to me.