(节点:71307)[DEP0079]弃用警告 [英] (node:71307) [DEP0079] DeprecationWarning

查看:644
本文介绍了(节点:71307)[DEP0079]弃用警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试更新MongoDB文档获取弃用警告为

Try to update MongoDB document Getting Deprecation Warning as


(节点:71307)[DEP0079]弃用警告:自定义检查功能
。对象通过.inspect()已弃用

(node:71307) [DEP0079] DeprecationWarning: Custom inspection function on Objects via .inspect() is deprecated

节点版本v10.5.0,
db版本v3.6.5,
Mongoose版本mongoose@4.1.12

Node version v10.5.0, db version v3.6.5, Mongoose version mongoose@4.1.12

Campground.findById(campgroundId, function(err, campground){
    if(err){
        console.log(err);
    } else {
        console.log(campground.celebrity);
        Celebrity.create(celebrityData, function(err, celebrity){
            if(err){
                console.log(err);
            } else {
                //save comment
                celebrity.save();
                campground.celebrity.push(celebrity);
                campground.save();
                console.log(celebrity);
                //req.flash('success', 'Created a comment!');
            }
        });
    }
});


推荐答案

你不必担心这个错误这是猫鼬警告 。实际上Mongoose使用inspect()来调试输出。他们将更新它可能在节点12.x之前。现在使用它是安全的。

You have to not worry about this error this is mongoose warning . Actually Mongoose use inspect() to debug output . they will update it may be before node 12.x . For now it is safe to use this.

无需担心。

检查此信息。
https://nodejs.org/api/deprecations.html#deprecations_dep0079_custom_inspection_function_on_objects_via_inspect


DEP0079:对象上的自定义检查功能通过.inspect()#类型:
运行时

DEP0079: Custom inspection function on Objects via .inspect()# Type: Runtime

不建议在对象上使用名为inspect的属性为util.inspect()指定自定义
检查函数。请改用
util.inspect.custom。为了与版本6.4.0之前的Node.js
向后兼容,可以指定两者。

Using a property named inspect on an object to specify a custom inspection function for util.inspect() is deprecated. Use util.inspect.custom instead. For backward compatibility with Node.js prior to version 6.4.0, both may be specified.

如果你想要更多细节,看到这个。这正在进行中。警告将在节点10中出现

If you want more detail, see this . This is under progress. Warning will come in node 10

https: //github.com/Automattic/mongoose/issues/6420

这篇关于(节点:71307)[DEP0079]弃用警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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