尝试更新MongoDB文档获取弃用警告为
(node:71307) [DEP0079] DeprecationWarning: Custom inspection function
on Objects via .inspect() is deprecated
节点版本v10.5.0,
db版本v3.6.5,
猫鼬版mongoose@4.1.12
Campground.findById(campgroundId,function(err,campground){ if(err){ console.log(err); } else { console.log(campground.celebrity); Celebrity.create(celebrityData,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之前.目前使用它是安全的.
没什么好担心的.
DEP0079: Custom inspection function on Objects via .inspect()# Type:
RuntimeUsing 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.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。