如何在 MongoDB 中删除此弃用警告以及为什么会发生这种情况? [英] How can I remove this deprecation warning in MongoDB and why is it happening?

查看:38
本文介绍了如何在 MongoDB 中删除此弃用警告以及为什么会发生这种情况?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想创建一个 API 并在我的 app.js 文件中连接到它,但每次运行 app.js 时我都会收到此弃用警告.我已经检查了 mongoose 和 MongoDB 中的所有弃用警告,但我找不到任何与我匹配的警告.我得到的警告是,

I am just trying to create an API and connect to it inside my app.js file but every time I run app.js I am getting this deprecation warning. I have checked all of the deprecation warnings in mongoose and MongoDB but I cannnot find any that match mine. The warning that I am getting is,

(node:16864) 警告:访问循环依赖中模块导出的不存在的属性MongoError"

(使用 node --trace-warnings ... 显示警告的创建位置)

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

为什么我会收到此弃用警告以及如何将其删除?

Why am I getting this deprecation warning and how can I remove it?

推荐答案

我猜这个警告出现在 mongoose 5.11.16 版本中.如果您想在错误得到修复之前避免看到它们,那么您可以选择 mongoose 版本 5.11.15.卸载 mongoose 5.11.16 并安装 npm install mongoose@5.11.15

I guess this warning occurs with mongoose 5.11.16 version. If you want to avoid seeing them until the bug gets fixed, instead you can go for mongoose version 5.11.15. Uninstall mongoose 5.11.16 and install npm install mongoose@5.11.15

这篇关于如何在 MongoDB 中删除此弃用警告以及为什么会发生这种情况?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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