0👍
Try to declare a pre middleware on the Office
schema:
Office.pre('findOneAndDelete', function(next) {
Department.updateMany({ offices: this._id }, {
$pull: { offices: this._id }
}).exec();
next();
});
- [Vuejs]-Official docs of design components tags for vuejs is needed please
- [Vuejs]-How can i set the focus to vue flat-pickr component?
0👍
Mistake was here
const officeModel = mongoose.model("Offices", Office);
module.exports = officeModel;
"Offices" needed to be "Office" 😀
Source:stackexchange.com