Skip to content

Instantly share code, notes, and snippets.

@DouglasHennrich
Last active August 29, 2015 14:14
Show Gist options
  • Save DouglasHennrich/854998179b045e476a59 to your computer and use it in GitHub Desktop.
Save DouglasHennrich/854998179b045e476a59 to your computer and use it in GitHub Desktop.
var mongoose = require( 'mongoose' );
var Schema = mongoose.Schema;
var CourseSchema = new Schema({
courseName : { type : String, default: '' }
, description : { type : String, default: '' }
, videos : { type : Array, default: [] } // Pensei em deixar a ordem cresc para o video
// mais novo ficar no final e para só ir dando push nesse array quando tiver
// novos videos.
, students: [{ type : Schema.Types.ObjectId, ref : 'Student' }] // Alunos autorizados
, created_at : { type : Date, default: Date.now }
});
module.exports = mongoose.model( "Course", CourseSchema );
var mongoose = require( 'mongoose' );
var Schema = mongoose.Schema;
var TeacherSchema = new Schema({
name : { type : String, default '', required: true }
, courses : [{ type : Schema.Types.ObjectId, ref : 'Course' }]
, abilities : { type : Array, default: [] } // Habilidades em MEAN, PHP, JQuery.. para ter um info do professor
, created_at : { type : Date, default: Date.now }
});
module.exports = mongoose.model( "Teacher", TeacherSchema );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment