const mongoose = require('mongoose');
const StudentSchema = new mongoose.Schema({
name: String,
enrollments: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Enrollment' }]
});
const ClassSchema = new mongoose.Schema({
name: String,
enrollments: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Enrollment' }]
});
const EnrollmentSchema = new mongoose.Schema({
student: { type: mongoose.Schema.Types.ObjectId, ref: 'Student' },
class: { type: mongoose.Schema.Types.ObjectId, ref: 'Class' }
});
const Student = mongoose.model('Student', StudentSchema);
const Class = mongoose.model('Class', ClassSchema);
const Enrollment = mongoose.model('Enrollment', EnrollmentSchema);