my application tracking student enrollment to different courses.
the schema is:
const userSchema = new mongoose.Schema({
username: String,
password: Number,
enrollment: []
})
and the enrollment array looks like this:
[{courseName: somename, courseTime:sometime},{courseName: somename2, courseTime:sometime2}]
the student can supply information whether he was attend at specific date on the course meeting or not.
so the thing I want to do is:
a) find the specific student b) find the the specific course of this student c) add to the object that contains this course additional object that contain date field and yes/no field.
so i wont it looks something like this:
[{courseName: somename, courseTime:sometime, newObject:{date:someDate, attendance:true}},{courseName: somename2, courseTime:sometime2,newObject:{date:someDate2, attendance:false}}]
I found similar questions in topics like this: update Object inside array of Object with mongoose or update Object inside array of Object with mongoose
and its not seems like a very hard task, but the problem is that I probably missing some simple syntax rules, because when I type this code into VScode I see picture like this:
any help would be much appreciated
