Unable to connect db because of "throw new MongoParseError('Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://"');"

I had this same issue and I resolved it by simply removing the “;” at the end of the connection string. So you connection string should just be:

"mongodb+srv://username:password@cluster0.lghcp.mongodb.net/?retryWrites=true&w=majority"

That is without the semi-colon at the end.

11 Likes