-
-
Notifications
You must be signed in to change notification settings - Fork 100
Fix missing Mongoose ref options on schema fields #2165
Copy link
Copy link
Open
Labels
complexity: smallfeature: DatabasehousekeepingNon-user story development taskNon-user story development taskrole: Back Endrole: Databasesize: 0.25ptCan be done in 1.5 hours or lessCan be done in 1.5 hours or less
Milestone
Metadata
Metadata
Assignees
Labels
complexity: smallfeature: DatabasehousekeepingNon-user story development taskNon-user story development taskrole: Back Endrole: Databasesize: 0.25ptCan be done in 1.5 hours or lessCan be done in 1.5 hours or less
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
StatusShow more project fields
Prioritized Backlog
Problem
9 fields across 6 model files are defined as plain
StringorNumbertypes without arefoption, which breaks.populate()calls at runtime.Affected Files
projectTeamMember.model.jsusersId,projectIdStringUser,ProjectcheckIn.model.jseventId,userIdStringRecurringEvent,Userevent.model.jsprojectIdStringProjectrecurringEvent.model.jsprojectIdStringProjectuser.model.jscurrentRoleNumberObjectIdref to future Role model, or keep as enum — needs decision)project.model.jsprojectStatus,googleDriveIdStringImpact
.populate()silently returnsnullfor these fields because Mongoose cannot resolve the referenceFix
Convert plain String fields to
{ type: Schema.Types.ObjectId, ref: "ModelName" }where an association exists. For fields that are true scalars (enums, IDs from external systems), ensure proper schema options are applied.Scope
Schema-only change — no API or UI modifications required.