尝试更新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.
如果您想了解更多细节,请参阅此内容.这正在进行中.警告将在节点10中出现