MongoParseError: URI does not have hostname, domain and tld

When running the app by npm start, the following error is crashing the app:
MongoParseError: URI does not have hostname, domain and tld

Can anyone please let me know the reason behind it?

Please see the image for the detailed error:

Thank you.

In your .env, after the @ only use the .mongodb.net piece of the string you get from the Short SRV connection string. (remove mongodb+srv:// from the beginning and /test from the end)
ie.,:
MFLIX_DB_URI=mongodb+srv://m220student:m220password@mflix-xxxxx.mongodb.net

Thanks @marylicanin,

Jeez, I thought I updated the .env file correctly. I was wrong.

Thanks for pointing out.

1 Like