Model.deleteOne()
Parameters
- conditions «Object»
[options] «Object» optional see
Query.prototype.setOptions()
[callback] «Function»
Returns:
- «Query»
Deletes the first document that matches conditions
from the collection. Behaves like remove()
, but deletes at most one document regardless of the single
option.
Example:
await Character.deleteOne({ name: 'Eddard Stark' });
Note:
This function triggers deleteOne
query hooks. Read the middleware docs to learn more.
当前内容版权归 mongoosejs 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 mongoosejs .