DeprecationWarning: Mongoose: `findOneAndUpdate()` and `findOneAndDelete()` without the `useFindAndM

DeprecationWarning: Mongoose: `findOneAndUpdate()` and `findOneAndDelete()` without the `useFindAndModify` option set to false are deprecated. See: https://mongoosejs.com/docs/deprecations.html#-findandmodify-

警告:Mongoose:不推荐使用未将“useFindAndModify”选项设置为false的“FindAndDupDate()”和“FindAndDelete()”。

使用mongoose的findOneAndUpdate、FindAndDelete两个方法,返回的数据是未更新的数据,但是库里的数据已经更新了;

解决办法:

new属性 true返回修改后的document;false返回原始数据;

发布了270 篇原创文章 · 获赞 50 · 访问量 11万+

猜你喜欢

转载自blog.csdn.net/Miss_liangrm/article/details/103794206
今日推荐