Mongoose: `findOneAndUpdate()` and `findOneAndDelete()` without the `useFindAndModify`

DeprecationWarning: Mongoose:findOneAndUpdate()andfindOneAndDelete()without theuseFindAndModifyoption set to false are deprecated
在这里插入图片描述
官网:https://mongoosejs.com/docs/deprecations.html
解决
入口文件加入

mongoose.set('useFindAndModify', false)
发布了41 篇原创文章 · 获赞 2 · 访问量 1836

猜你喜欢

转载自blog.csdn.net/weixin_43883485/article/details/105196730