refactor(config): 移除 MongoDB 连接中的冗余配置项

- 删除了 mongoose.connect 中的 useNewUrlParser 和 useUnifiedTopology 配置项
- 这些配置项在新版的 mongoose 中已经默认启用,无需显式设置
This commit is contained in:
LingandRX 2024-12-30 22:25:33 +08:00
parent 7ea50c9d52
commit 927405f858

View File

@ -23,10 +23,7 @@ exports.connectMongoDB = async function () {
try {
const mongoDBUrl = `mongodb://${account}:${password}@${host}:${port}`
mongoose.connect(mongoDBUrl, {
useNewUrlParser: true,
useUnifiedTopology: true
})
mongoose.connect(mongoDBUrl)
mongoose.connection.on('open', () => {
console.log('MongoDB 连接成功')