Answers for "server is waiting on http://localhost:undefined 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."

3

MongooseError: 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.

mongoose.connect(), first argument should be String, received undefined

//If .env file is used in config folder, make sure the DB_STRING is associated with its
//value, which is the mongodb connection string from the cluster
//Next, install dotenv and require it in the app.js file:

require("dotenv").config({ path: "./config/.env" });
Posted by: Guest on June-26-2021

Code answers related to "server is waiting on http://localhost:undefined 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."

Browse Popular Code Answers by Language