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

This was my problem when the mongoose.connect() in my index.js file would not read my process.env. value.

Inside my .env file I had the semi-colon at the end as I usually do when writing JavaScript code:
MONGO_URL=“mongodb+srv:…”;

After removing the semi-colons in my .env files thing were finally working in index.js.

Thank you for this solution.

1 Like