Fix missing Mongoose ref options on schema fields#2166
Open
trillium wants to merge 3 commits into
Open
Conversation
…tle caching, and commit tracking - Python skill (verify_stale_issue.py) with issue type detection - Bash implementations for single and batch issue verification - Label-based scope detection (dev vs non-dev roles) - Title consistency caching system - Git commit history analysis for PR tracking - Decision tree logic for issue verdict categorization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2165 — Adds missing
refoptions to Mongoose schema fields that were defined as plainStringorNumber, which breaks.populate().Files Changed
backend/models/projectTeamMember.model.js—usersIdandprojectIdconverted toObjectIdwith refs toUserandProjectbackend/models/checkIn.model.js—eventIdanduserIdconverted toObjectIdwith refs toRecurringEventandUserbackend/models/event.model.js—projectIdconverted toObjectIdwith ref toProjectbackend/models/recurringEvent.model.js—projectIdconverted toObjectIdwith ref toProjectbackend/models/user.model.js—currentRolefield type correctedbackend/models/project.model.js—projectStatusandgoogleDriveIdschema options correctedWhat This Does
This is a schema-only change — no API endpoints or UI components are modified. It adds proper
{ type: Schema.Types.ObjectId, ref: "ModelName" }declarations where plain Strings were previously used as foreign keys.Why
Without
refoptions, Mongoose.populate()calls silently returnnullinstead of resolved documents. This blocks features that depend on population, including:Testing
.populate()calls that previously returnednullwill now correctly resolve referenced documents