Error: Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://"


I am very new to this. I first for the error of

Error: The uri parameter to openUri() must be a string, got “undefined”. Make sure the first parameter to mongoose.connect() or mongoose.createConnection() is a string.

but my conectDB was below dotenv. I saw someone saying ‘process.env.MONGO_URI’ should be in string so i did that, while the error disappeared, this new error is now here.

I have searched for some solutions but nothing seems to work.

MONGO_URI = 'mongodb+srv://'

const mongoose = require("mongoose");
const colors = require("colors");

const connectDB = async () => {
  try {
    const conn = await mongoose.connect("process.env.MONGO_URI", {
      useNewUrlParser: true,
      useUnifiedTopology: true,
      useFindAndModify: true,

    console.log(`MongoDB Connected: ${}`.cyan.underline);
  } catch (error) {
    console.log(`Error: ${error.message}`.red.bold);

module.exports = connectDB;

Any help would be appreciated, as my presentation is tomorrow ^^

Hi, I know this is months after you needed the answer, but whenever I try to connect to public wireless internet, such as a cafe, I get this error, but I never see this at home or at the office where the network is private. I hope it magically worked and your presentation was great