Usuń
DocSchema.pre('deleteOne', { document: true }, function() {
console.log(this)
})
//You must first find the document before deleting it.
const doc = await DocSchema.findOne({ name: 'myDoc' })
await doc.deleteOne()
Liz