Hi all,
I hope whoever is reading this is having a great day! I am currently trying to connect my mongodb Atlas to my React app using node.JS but I am getting the error TypeError: Cannot read property 'replace' of undefined at matchesParentDomain (uri_parser.js:24) at uri_parser.js:67
I have posted my (extremely simple) code below
const {MongoClient} = require('mongodb');
async function main(){
const uri = "mongodb+srv://{username}:{password}@cluster0.5r4og.mongodb.net/{dbname}?retryWrites=true&w=majority";
const client = await new MongoClient(uri, { useNewUrlParser: true, useUnifiedTopology: true});
try {
await client.connect();
} catch (e) {
console.error(e);
} finally {
await client.close();
}
}
main().catch(console.error);