node.js - 错误:不支持选项 gssapiservicename
问题描述
猫鼬(6.0.12)抛出错误Error: option gssapiservicename is not supported
。
这里是设置 mongodb 连接的代码:
const connectDB = async () => {
try {
const conn = await mongoose.connect(process.env.MONGO_URI, {
useUnifiedTopology: true,
useNewUrlParser: true,
})
console.log(`MongoDB Connected: ${conn.connection.host}`.cyan.underline)
} catch (error) {
console.error(`Error: ${error.message}`.red.underline.bold)
process.exit(1)
}
}
解决方案
只需删除连接字符串中的参数,较新版本的客户端不再支持此功能
推荐阅读
- python - Python 嵌套循环替代方案
- windows - 在 Windows 和 WSL 应用程序之间共享网络
- async-await - MVC ActionResult 在返回 View() 之前触发异步任务
- android - 升级后在 nfc_in_flutter 上构建失败
- php - 验证用户是否从 php 中所有美国州的下拉菜单中选择了一个州的最简单方法
- c - 为什么我的 printf 总是重复第一个输出
- r - 如果与其他列匹配,则为 DT 表列着色
- ios - 将 NSArray (Swift) 转换为向量 (C++)
- python - 如何解决此错误“输入用尽”
- mysql - MYSQL:选择一列的 SUM 但该列基于另一个行 ID