更新时间:2023-12-04 23:29:58
问题很可能是您的模型没有附加架构.
Very likely the problem is that your model does not have a schema attached.
const { Schema } = require('mongoose');
const StudentSchema = new Schema({
firstName: {type: String, required: true},
lastName: {type: String, required: true},
age: {type: Number},
facultyNumber: {type: String, unique: true}
}};
let Student = mongoose.model('Student', StudentSchema);