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

hello, i keep getting this message in my terminal. "DeprecationWarning"

i was fallowing along in the full stack java script course and i got stuck on this. i get this in the terminal "DerpecationWarning: 'open()' is deprecated in mongoose >= 4.11.0, use 'openUri()' instead, or set the "useMongoClien option if using "connect()" or 'createConnection()' ". i cant post my data from my sign up script. Im lost please help.

Johannes Scribante
Johannes Scribante
19,175 Points

Hi Scott,

I had the exact same issue a little while back. Basically as libraries are updated old code is 'written-off' or 'no longer supported' meaning that the new functions and internal working of the libraries no longer use those deprecated items.

If you look at the version number or Mongo used in the video, you'll notice a large version difference.

Basically the new version does not automatically include promises, therefore you have to define the promises.
mongoose.Promise = global.Promise; // define global promises
mongoose.connect('mongodb://localhost:27017/insert_your_name_here', { useMongoClient: true }); // define to use mongo as the client
let db = mongoose.connection;

This is how I understand it, if someone else can clarify the exact use of global.Promise or useMongoClient: true that would be AWESOME!!