Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

deleteOne

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()
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #deleteOne
ADD COMMENT
Topic
Name
7+3 =