RoleModel.pre('deleteOne', async function(next) { try { let deletedItemId = (this._conditions && this._conditions._id) ? this._conditions._id : null; if(deletedItemId){ await UserModel.deleteMany({ 'role': deletedItemId }); } next(); } catch (e) { console.log(e); } });