我安装了最新版本的 winston-mongodb
. 我注意到 winston-mongodb
包的 mongodb
版本已从 1.6.6
版本更新为 2.0.7
版本 . 更新后我得到了这个 warning
:
不推荐使用server / replset / mongos选项,在options对象的顶层支持所有选项[poolSize,ssl,sslValidate,sslCA,sslCert,sslKey,sslPass,autoReconnect,noDelay,keepAlive,connectTimeoutMS,socketTimeoutMS,reconnectTries ,reconnectInterval,哈,haInterval,replicaSet,secondaryAcceptableLatencyMS,acceptableLatencyMS,connectWithNoPrimary,authSource,W,wtimeout,J,forceServerObjectId,serializeFunctions,ignoreUndefined,生,promoteLongs,bufferMaxEntries,readPreference,pkFactory,promiseLibrary,readConcern,maxStalenessSeconds,loggerLevel, Logger ,promoteValues ,promoteBuffers,promoteLongs,domainsEnabled,keepAliveInitialDelay,checkServerIdentity,validateOptions]
我怎么解决这个问题?任何的想法?
3 回答
根据错误信息;
the server/replset/mongos options are deprecated, all their options are supported at the top level of the options object
因此,问题的解决方案只是将设置选项从服务器,replset,socketOptions,mongos和任何其他层次结构选项移动到对象的顶层 .
希望能帮助到你!谢谢,
I noticed this as well.
看来这是一个非致命的错误,因为这个问题已经关闭 . 见:https://jira.mongodb.org/browse/NODE-941 . 我测试过:mongodb@2.2.24 - 当你报告警告时给出!!! mongodb@2.2.23 - 因错误而死亡 . mongodb@2.2.22 - 没有警告,工作正常....
So I would recommend to install verson 2.2.22 现在看看给出了 . 这就是我所做的 - 因为我不喜欢看到警告 .
我希望这有帮助 .
如果从4.x升级到5.x并且您没有在4.x中使用useMongoClient选项,则可能会看到以下弃用警告:
the server/replset/mongos options are deprecated, all their options are supported at the top level of the options object
在旧版本的MongoDB驱动程序中,您必须为服务器连接,副本集连接和mongos连接指定不同的选项:
在mongoose v5.x中,您可以在顶层声明这些选项,而不需要额外的嵌套 .
来源:官方文件http://mongoosejs.com/docs/connections.html