Tell us what’s happening:
There are errors when I try to run the server. It seems the problem is at uri_parser.js:50 - if (result.hostname.split(‘.’).length < 3) is the issue. Not sure what’s wrong or how to fix it.
I set up my MONGO_URI = ‘mongodb+srv://username:password@cluster.gntry7i.mongodb.net/?retryWrites=true&w=majority’.
I required mongoose as mongoose in a variable and used mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true }); to connect to the DB, but the server cannot start with this error: cannot read properties of null (reading ‘split’)
Your project link(s)
solution: boilerplate-mongomongoose - Replit
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
Challenge: MongoDB and Mongoose - Install and Set Up Mongoose
Link to the challenge: