DEV Community

Discussion on: FullStack setup (Node.js, React.js and MongoDB)

Collapse
 
ryukikikie profile image
Ryuki Kuga • Edited

Just sharing
If you got these error messages below,
(node:48490) 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.
(node:48490) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.

Change the code something like this

mongoose.connect(
process.env.MONGOD_URL || mongodb://localhost:27017/fdaksjfafdsfasa,
{ useNewUrlParser: true, useUnifiedTopology: true },
(err) => {
if (err) console.error(err);
else console.log("Connected to the mongodb");
}
);