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