当我将课程推送到课程数组时,我试图阻止添加_id。但它似乎没有起作用。我没有正确设置架构吗?
var classSchema = new Schema({
title: { type: String, required: true },
description: { type: String, required: true },
lessons: [{
lesson_id: {type: mongoose.Schema.Types.ObjectId, ref: 'Lesson', '_id': false }
}]
});