我是MERN堆栈的新手,我得到了这个错误。
[nodemon] restarting due to changes...
[nodemon] starting `node index.js`
bad auth : Authentication failed.以下是我尝试更改密码的代码,但无能为力
import express from "express";
import bodyParser from "body-parser";
import mongoose from "mongoose";
import cors from "cors";
const app = express();
app.use(bodyParser.json({ limit: "30mb", extended: true }));
app.use(bodyParser.urlencoded({ limit: "30mb", extended: true }));
app.use(cors());
const CONNETCION_URL =
"mongodb+srv://myratcharyyev:<password>@cluster0.mn9xi.mongodb.net/myFirstDatabase?retryWrites=true&w=majority";
const PORT = process.env.PORT || 5000;
mongoose
.connect(CONNETCION_URL, { useNewUrlParser: true, useUnifiedTopology: true })
.then(() =>
app.listen([PORT, () => console.log(`Server running on port : ${PORT}`)])
)
.catch((error) => console.log(error.message));
// mongoose.set("useFindAndModify", false);发布于 2021-09-11 17:50:43
const CONNETCION_URL =
"mongodb+srv://myratcharyyev:<password>@cluster0.mn9xi.mongodb.net/myFirstDatabase?retryWrites=true&w=majority";
const PORT = process.env.PORT || 5000;在CONNETCION_URL中,您是否在运行代码时将<password>更改为您在mongodb站点上设置的set
https://stackoverflow.com/questions/69069813
复制相似问题