问题描述
在猫鼬文档中,它经常列出某些查询运算符的可选回调(例如findOneAndUpdate
),但是它没有提到回调采用什么参数(参数).他们是什么,我怎么知道?
In the mongoose documentation it frequently lists an optional callback for certain query operators (like findOneAndUpdate
), however, it does not mention what parameters (arguments) the callback takes. What are they, and how would I find out?
此外,如果conditions
,update
等是可选的,并且我想在末尾指定一个回调,我是否必须传递null
值或空对象,还是可以仅指定回调-猫鼬知道软管吗?
Also, if conditions
, update
etc. are optional, and I want to specify a callback at the end, do I have to pass in the null
value, or empty objects or can I just specify the callback -- and hose does Mongoose know?
Model.findOneAndUpdate([conditions], [update], [options], [callback])
推荐答案
几乎所有猫鼬查询提供的callback
函数将在节点回调模式 callback(err, results)
如文档中所述:
这篇关于什么参数传递给Mongoose回调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!