Design MongoDB schemas — Mongoose models with validation, indexes, relationships. Triggers: 'schema', 'model', 'data model', 'collection design', 'Mongoose schema'.
Design MongoDB schemas with Mongoose, including validation, indexes, and relationship strategies.
populate() for referenced documents; avoid deep nesting beyond 2 levels.String, Number, ObjectId, Date, Boolean, [SubSchema]).required, enum, minlength, maxlength, min, max, match validators as needed.src/models/<EntityName>.js (or .ts).module.exports = mongoose.model('EntityName', entitySchema);.{ timestamps: true } for automatic createdAt / updatedAt.fullName from firstName + lastName).toJSON: { virtuals: true } and toObject: { virtuals: true } in schema options.architecture/ as an ADR.state/STATE.md with the new or modified model.src/models/.