使用Node.js MongoDB驱动程序3.2.4的官方最新版本并进行
const MongoClient = require('mongodb').MongoClient;
const client = new MongoClient(url, {
useNewUrlParser: true,
connectTimeoutMS: 10000,
poolSize: 10,
j: true,
reconnectInterval: 2000,
reconnectTries: 150
});
client.connect();
setTimeout(() => {
client.close();
setTimeout(() => {
client.connect();
}, 1000);
}, 1000);
我希望它能够连接,等待一秒钟,断开连接,等待一秒钟,然后再次连接。
但是我遇到了错误:
the options [servers] is not supported
the options [caseTranslate] is not supported
server instance pool was destroyed
调用close之后是否无法再次连接?