Bug Description
The refreshToken field is defined twice in userSchema[cite: 1].
- It appears once at lines 80–83[cite: 1].
- It appears again at lines 113–116 under the comment "Add this field for refresh token system."[cite: 1].
Technical Impact
- Mongoose silently uses the last definition encountered for duplicate keys in a schema object literal[cite: 1].
- While both definitions are currently identical, this is a latent data integrity risk[cite: 1].
- If either definition is modified independently during a refactor (e.g., adding a
select: false only to one), the behavior will change unexpectedly without a visible error, and the duplicate will hide the regression[cite: 1].
Location & Severity
- File:
models/User.js[cite: 1]
- Severity: Medium[cite: 1]
Bug Description
The
refreshTokenfield is defined twice inuserSchema[cite: 1].Technical Impact
select: falseonly to one), the behavior will change unexpectedly without a visible error, and the duplicate will hide the regression[cite: 1].Location & Severity
models/User.js[cite: 1]