I tried to connect to MongoDB using a connection string copied from the Atlas cluster dashboard. But it throws the exception "The connection string is not Valid".
Later I found out, it was due to a "@" character in my password. Solved the issue by changing my password.
Sharing this for people who may encounter this.