I'm using mongoose and typescript and I remember when I wanted to access the updated document in updateOne pre-middleware, I use this code
Schema.pre('updateOne', function (next) {
const data = this.getUpdate()
next()
})
but I can't use getUpdate() method in typescript so, What is the alternative to get access to the updated document?