node.js - 弃用警告 : Listening to events on the Db class has been deprecated and will be removed in the next major version

标签 node.js mongodb mongoose deprecation-warning

我正在使用 mongoose 和 mocha 进行 MongoDB 模式设计和 API 开发
我收到此警告...
这是什么意思,它将如何影响我以及修复方法是什么?
在实际警告文本下方:

(node:9872) DeprecationWarning: Listening to events on the Db class has been deprecated and will be removed in the next major version.

最佳答案

更新
mongodb@3.6.5出来了。
只需更新 mongodb 驱动程序和 Mongoose :

npm i mongodb mongoose

这是由 mongodb@3.6.4 native driver 引起的这是 Mongoose 使用的。
#1 您可以将 mongodb 降级到版本 3.6.3 ( described here )。
#2 或者将 mongoose 从 5.11.16 降级回 5.11.15:
npm uninstall mongoose
npm install mongoose@5.11.15
#3 或者就等mongodb@3.6.5的发布吧。

关于node.js - 弃用警告 : Listening to events on the Db class has been deprecated and will be removed in the next major version,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66190532/

相关文章:

node.js - 套接字.io : how to control & check the message flow?

node.js - 将查询生成器条件转换为 MongoDB 操作,包括子文档的嵌套数组

MongoDB - 我可以使用 ObjectId 作为键吗?

node.js - 带有 .validate() 的 Mocha 测试模式不返回

node.js - 如何继承 Mongoose 模型并将其存储在不同的集合中

c++ - NodeJS源代码找不到set_immediate_callback_function定义

node.js - 更改 Node.js 监听端口

node.js - 关于使用 Node 和 mongo 迁移到 TDD

node.js - ( Node :63208) DeprecationWarning: collection. ensureIndex 已弃用。请改用 createIndexes

php - 如何从另一个 PHP 类连接到 MongoDB?