refactor(config): 移除 MongoDB 连接中的冗余配置项
- 删除了 mongoose.connect 中的 useNewUrlParser 和 useUnifiedTopology 配置项 - 这些配置项在新版的 mongoose 中已经默认启用,无需显式设置
This commit is contained in:
parent
7ea50c9d52
commit
927405f858
@ -23,10 +23,7 @@ exports.connectMongoDB = async function () {
|
|||||||
try {
|
try {
|
||||||
const mongoDBUrl = `mongodb://${account}:${password}@${host}:${port}`
|
const mongoDBUrl = `mongodb://${account}:${password}@${host}:${port}`
|
||||||
|
|
||||||
mongoose.connect(mongoDBUrl, {
|
mongoose.connect(mongoDBUrl)
|
||||||
useNewUrlParser: true,
|
|
||||||
useUnifiedTopology: true
|
|
||||||
})
|
|
||||||
|
|
||||||
mongoose.connection.on('open', () => {
|
mongoose.connection.on('open', () => {
|
||||||
console.log('MongoDB 连接成功')
|
console.log('MongoDB 连接成功')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user