Professional Documents
Culture Documents
Student Consultation Database
Student Consultation Database
// MongoDB Playground
// Use Ctrl+Space inside a snippet or a string literal to trigger completions.
// LecturerDetails
db.createCollection('lecturer_details', {
validator: {
$jsonSchema: {
bsonType: 'object',
required: ['lecturerId', 'firstName', 'lastName'],
properties: {
lecturerId: {
bsonType: 'string',
description: 'must be a string'
},
firstName: {
bsonType: 'string',
description: 'must be a string'
},
lastName: {
bsonType: 'string',
description: 'must be a string'
},
}
},
}
});
// ConsultationPeriods
db.createCollection('consultation_periods', {
validator: {
$jsonSchema: {
bsonType: 'object',
required: ['lecturerId', 'dayOfWeek', 'startTime', 'endTime',
'durationMinutes', 'maximumNumberOfConsultationsPerDay', 'numberOfStudents'],
properties: {
lecturerId: {
bsonType: 'string',
description: 'must be a string'
},
dayOfWeek: {
enum: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday',
'Saturday', 'Sunday'],
description: 'must be a day of the week and is required'
},
startTime: {
bsonType: 'string',
description: 'must be a string representing time'
},
endTime: {
bsonType: 'string',
description: 'must be a string representing time'
},
durationMinutes: {
bsonType: 'int',
description: 'must be an integer'
},
maximumNumberOfConsultationsPerDay: {
bsonType: 'int',
description: 'must be an integer'
},
numberOfStudents: {
bsonType: 'int',
description: 'must be an integer'
},
}
},
}
});
// StudentBooking
db.createCollection('student_booking', {
validator: {
$jsonSchema: {
bsonType: 'object',
required: ['consultationId', 'studentEmailAddress', 'role'],
properties: {
consultationId: {
bsonType: 'int',
description: 'must be an integer'
},
studentEmailAddress: {
bsonType: 'string',
description: 'must be a string'
},
role: {
bsonType: 'string',
description: 'must be a string'
},
}
},
}
});
// StudentDetails
db.createCollection('student_details', {
validator: {
$jsonSchema: {
bsonType: 'object',
required: ['studentNumber', 'studentEmailAddress', 'firstName', 'lastName'],
properties: {
studentNumber: {
bsonType: 'string',
description: 'must be a string'
},
studentEmailAddress: {
bsonType: 'string',
description: 'must be a string'
},
firstName: {
bsonType: 'string',
description: 'must be a string'
},
lastName: {
bsonType: 'string',
description: 'must be a string'
},
}
},
}
});