I have a Node.js application that connects to Mongo Atlas with a M0 custer running Mongo 4.2

The application previously ran with Mongo Atlas and only after switching the DB to a new cluster did it result in no connection working. If I console.log on no error it shows it connected and if I console.log the error message it is null.

I am using Mongoose to connect to Mongo.

I have the correct permissions for the user selected, it has for testing wide open read and write permissions. I have changed the network settings too to be wide open on so everyone should be able to connect.

If I put the connection string pasted in then it works however when I use it as a env variable is fails to let me execute queries on the DB. I have done a console.log for the db string - yes it had the password and went into my logging tool so I will change the password once working, the result of the console.log is the exact same as the connection string I paste in.

What could be a cause for this issue? I can't see it being my code since it used to work and is putting in the correct connection string. Maybe a setting on Mongo Atlas that I have to change to let me read/write to it?