node - DeprecationWarning: Mongoose: `findOneAndUpdate()` and `findOneAndDelete()` without the `us

Posted 500m

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了node - DeprecationWarning: Mongoose: `findOneAndUpdate()` and `findOneAndDelete()` without the `us相关的知识,希望对你有一定的参考价值。

       1,  原因是因为:findOneAndUpdate()内部会使用findAndModify驱动,驱动即将被废弃,所以弹出警告!附上官方解释:Mongoose v5.5.8: Deprecation Warnings


  2,  解决方法

   在使用mongose时全局设置

        mongoose.set(‘useFindAndModify‘, false)

 

以上是关于node - DeprecationWarning: Mongoose: `findOneAndUpdate()` and `findOneAndDelete()` without the `us的主要内容,如果未能解决你的问题,请参考以下文章