E QUERY [thread1] Error: Invalid port number "m220password@cluster0-i0nyj.mongodb.net" in connection string "mongodb+srv://m220student:m220password@cluster0-i0nyj.mongodb.net/test?retryWrites=true" : connect@src/mongo/shell/mongo.js:211:1

E QUERY [thread1] Error: Invalid port number "m220password@cluster0-i0nyj.mongodb.net" in connection string “mongodb+srv://m220student:m220password@cluster0-i0nyj.mongodb.net/test?retryWrites=true” :
connect@src/mongo/shell/mongo.js:211:1

HI I am having this issue while proving my Mongo Atlas connection.

Hi @gerutz,

Please make sure the connection string is assigned to MFLIX_DB_URI variable instead of PORT variable.

My .env file looks like this:

SECRET_KEY=super_secret_key_you_should_change
MFLIX_DB_URI=mongodb+srv://m220student:m220password@mflix-21t7x.mongodb.net/test? retryWrites=true
MFLIX_NS=mflix
PORT=5000

Kanika