Skip to main content
MongoDB database name is taken from MONGODB_URI (typically d79-directory). Collection relationships and the ownership vs collaboration split are on Data relationships.

User

Collection: users Indexes: { email, isActive }, { schoolName, isActive }, { assignedForms.formId }. schoolName is a denormalized display string. Super Admins maintain the catalog in School; renaming a school updates matching User.schoolName and FormSubmission.schoolName values.

School

Collection: schools. Super Admin catalog at /admin/schools. First list load upserts the static District 79 names plus any names already on users or plans ($setOnInsert only — deactivated rows stay deactivated). Delete is refused while users or plans still use the name; deactivate instead.

FormSubmission

Collection: formsubmissions formData[stepKey] shape:
Most answers are strings or booleans. Table questions store:
Column types (text vs dropdown) live on the question bank question.columns, not on the answer. See How to fill a table question. Partial unique index schoolName_schoolYear_unique on { schoolName: 1, schoolYear: 1 } (only when schoolYear is a non-empty string). Duplicate and create routes return 409 when a school already has a plan for that year. Super Admin System reports whether this index is present.

FormTemplate

Collection: formtemplates
  • Unique version
  • status: draft | published | archived
  • schoolYear optional
  • steps[]: { id, key, title, questions[] }
  • Question: { id, question_number, title, placeholder, type, required, description, active, order } plus extra keys (strict: false) such as columns (table presets), gatesFollowing, visibleWhen, intro text

SchoolYearSettings

Collection: schoolyearsettings — unique schoolYear. archived, archivedAt, archivedBy, questionBankVersion, deadlines[], districtGoals[].

FormComment

Collection: formcomments formId, reviewer identity, comment, status, optional stepNumber / stepKey, isActive, isFixed, readBy.

AuditLog

Collection: auditlogs How-to and field list: Audit logs and admin tables. action enum: login, logout, user_created, user_updated, user_deleted, user_activated, user_deactivated, form_created, form_duplicated, form_attested, form_edited, form_submitted, form_approved, form_rejected, form_shared, form_unshared, form_ownership_transferred, permission_changed, bulk_action, csv_import, export, settings_changed, school_created, school_updated, school_deleted, question_bank_seeded, question_bank_updated, question_bank_published, other. targetType: user | form | system | school | other. Also userName, userEmail, targetId, details, metadata, ipAddress, userAgent, timestamp.