bryantheastronaut / mernCommentBox

A Tutorial on creating a MERN Stack App from the Facebook Comment React Tutorial
https://medium.com/@bryantheastronaut/react-getting-started-the-mern-stack-tutorial-feat-es6-de1a2886be50
248 stars 92 forks source link

Mongoose connection logic used is deprecated #7

Closed pjcevans closed 6 years ago

pjcevans commented 7 years ago

Not sure if you're interested in keeping this tut up to date but providing feedback in case you are!

Connecting using Mongoose ^4.11.0 fails with the connection method used in the tutorial due to a change at Mongo HQ

The error and fix are detailed here: http://mongoosejs.com/docs/connections.html#use-mongo-client

pjcevans commented 7 years ago

Specifically I connected using this based on MDN:

var mongoDB = 'mongodb://user:password@ds123.mlab.com:61123/database-name'; mongoose.connect(mongoDB, { useMongoClient: true }) var db = mongoose.connection; db.on('error', console.error.bind(console, 'MongoDB connection error:'));