problem description
create a student Schame, with mongoose but report an error at run time, the error is in the Schema; of the third line
TypeError: schema is not a constructor
looked at the code did not find a mistake, please help to have a look, thank you!
related codes
var mongoose = require("mongoose"),
Schema = mongoose.Schema;
const courseInf = new Schema({
teacher:String,
courseName:String
});
const student = new Schema({
name:String, //
class:String, //
stunum:String, //
oldpassword:String, //
newpassword:String, //
phonenum:String, //
course:[courseInf] //
});
module.exports.stu = mongoose.model("student",student);