【发布时间】:2020-04-15 08:36:14
【问题描述】:
设置useUnifiedTopology=true后,自动重新连接停止工作并产生以下错误:
DeprecationWarning: The option `reconnectInterval` is incompatible with the unified topology
DeprecationWarning: The option `reconnectTries` is incompatible with the unified topology
DeprecationWarning: The option `autoReconnect` is incompatible with the unified topology
如何让服务器自动重新连接该新标志?
我正在使用mongoose.createConnection 连接以下选项:
{
autoReconnect: true,
keepAliveInitialDelay: 300000,
connectTimeoutMS: 300000,
reconnectTries: Number.MAX_VALUE,
reconnectInterval: 1000,
useNewUrlParser: true,
useUnifiedTopology: true,
useCreateIndex: true,
poolSize: 10,
auth: {
authSource: "admin"
},
user: process.env.MONGO_USER,
pass: process.env.MONGO_PASS
}
【问题讨论】:
标签: node.js mongoose node-mongodb-native