Bug: TemplateData pre-save hook uses next callback (Mongoose 9.x incompatible)
File: server/models/TemplateData.js:52-55
Problem
The pre-save hook uses the old Mongoose pattern with next callback:
TemplateDataSchema.pre('save', function (next) {
this.updatedAt = new Date();
next();
});
In Mongoose 9.x, the next parameter is no longer passed to pre('save') hooks. This causes TypeError: next is not a function on every TemplateData.create() or .save() call.
Fix
Remove the next callback — Mongoose 9.x automatically calls next() after the hook function returns:
TemplateDataSchema.pre('save', function () {
this.updatedAt = new Date();
});
Severity
Critical — Every template creation/save throws an error. The sync endpoint and any future template writes are broken.
Status
Fix already exists in PR #29 (Phase 4). This issue tracks it for visibility.
Phase
Introduced in Phase 1 (PR #26, merged).
Bug: TemplateData pre-save hook uses
nextcallback (Mongoose 9.x incompatible)File:
server/models/TemplateData.js:52-55Problem
The pre-save hook uses the old Mongoose pattern with
nextcallback:In Mongoose 9.x, the
nextparameter is no longer passed topre('save')hooks. This causesTypeError: next is not a functionon everyTemplateData.create()or.save()call.Fix
Remove the
nextcallback — Mongoose 9.x automatically callsnext()after the hook function returns:Severity
Critical — Every template creation/save throws an error. The sync endpoint and any future template writes are broken.
Status
Fix already exists in PR #29 (Phase 4). This issue tracks it for visibility.
Phase
Introduced in Phase 1 (PR #26, merged).