mongoose difference of findOneAndUpdate and update

后端 未结 3 1554
轻奢々
轻奢々 2020-12-15 03:11

What is difference of findOneAndUpdate and update? Both accept criteria to query and doc to update.

3条回答
  •  南笙
    南笙 (楼主)
    2020-12-15 03:27

    The .findOneAndUpdate method issues a mongodb .findAndModify update command and returns the found document (if any) to the callback or return the modified document rather than the original if the new option is true and the .update execute the query as an update() operation.

提交回复
热议问题