DeprecationWarning:在 Db 类上监听事件已被弃用,将在下一个主要版本中删除 [英] DeprecationWarning: Listening to events on the Db class has been deprecated and will be removed in the next major version

查看:99
本文介绍了DeprecationWarning:在 Db 类上监听事件已被弃用,将在下一个主要版本中删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using mongoose and mocha for MongoDB schema design and API development I am getting this warning... what does this mean, how it will affect me and what is the fix??

在实际警告文本下方:

(node:9872) DeprecationWarning:监听 Db 类的事件已被弃用,将在下一个主要版本中删除.

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

推荐答案

UPDATE

mongodb@3.6.5 已发布.

只需更新 mongodb 驱动和 mongoose:

Just update mongodb driver and mongoose:

npm i mongodb mongoose


这是由 mongoose 使用的 mongodb@3.6.4 native driver 引起的.

#1您可以将 mongodb 降级到 3.6.3 版(此处描述).

#1 You can downgrade mongodb to version 3.6.3 (described here).

#2 或者将 mongoose 从 5.11.16 降级回 5.11.15:

#2 Or downgrade mongoose from 5.11.16 back to 5.11.15:

npm uninstall mongoose
npm install mongoose@5.11.15

#3 或者就等 mongodb@3.6.5 发布.

#3 Or just wait for the release of mongodb@3.6.5.

这篇关于DeprecationWarning:在 Db 类上监听事件已被弃用,将在下一个主要版本中删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆