问题描述
我已经安装了最新版本的winston-mongodb
.我注意到winston-mongodb
包中mongodb
的版本已从1.6.6
版本更新为2.0.7
版本.更新后,我得到了这个warning
:
I've installed the latest version of winston-mongodb
. I've noticed that the version of mongodb
from winston-mongodb
package has updated from 1.6.6
version to 2.0.7
version. After updating I got this warning
:
我该如何解决?有什么主意吗?
How can I solve this? Any idea?
推荐答案
根据错误消息;
the server/replset/mongos options are deprecated, all their options are supported at the top level of the options object
因此,解决该问题的方法只是将服务器,replset,socketOptions,mongos和任何其他层次结构选项中的设置选项移到对象的顶层.
so, solution for the problem is simply moving the setting options from the server, replset, socketOptions, mongos and any other hierarchy options up into the top level of the object.
mongoose.connect( 'mongodb://localhost/db',
{
useMongoClient: true,
server: {
ssl: true,
socketOptions: {
keepAlive: 300000,
connectTimeoutMS: 30000
},
auto_reconnect: true,
reconnectTries: 300000,
reconnectInterval: 5000
},
promiseLibrary: global.Promise
}
);
change it to;
mongoose.connect( 'mongodb://localhost/db',
{
useMongoClient: true,
poolSize: 2,
ssl: true,
keepAlive: 300000,
connectTimeoutMS: 30000,
autoReconnect: true,
reconnectTries: 300000,
reconnectInterval: 5000,
promiseLibrary: global.Promise
}
);
希望有帮助!谢谢,
这篇关于更新mongodb依赖项后发出警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!