📜  MongooseError:`openUri()` 的 `uri` 参数必须是字符串,得到“未定义”.确保 `mongoose.connect()` 或 `mongoose.createConnection()` 的第一个参数是一个字符串. - 无论代码示例

📅  最后修改于: 2022-03-11 15:00:52.254000             🧑  作者: Mango

代码示例1
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" });