MongoParseError:不支持选项 useCreateIndex、useFindAndModify
我试图运行它,它说像标题一样的错误。这是我的代码:
const URI = process.env.MONGODB_URL;
mongoose.connect(URI, {
useCreatendex: true,
useFindAndModify: false,
useNewUrlParser: true,
useUnifiedTopology: true
}, err => {
if(err) throw err;
console.log('Connected to MongoDB!!!')
})
我在 .env 中设置了 MONGODB_URL :
MONGODB_URL = mongodb+srv://username:<password>@cluster0.accdl.mongodb.net/website?retryWrites=true&w=majority
如何解决?
回答
来自猫鼬 6.0文档:
THE END
二维码