Create, Update and Delete arrays within arrays in mongoose

I have a schema like below..

courses : [{
          institution : String,
          from : Date,
          to : Date,
          overallScore :String,
          coursework : [{
           semesterName : String,
           score : String,
           from : Date,
           to : Date
          }]
}]

I know how to add a new coursework, but how do I update a value in a specific coursework based on the _id generated by each coursework, when there are multiple coursework items? Also, similarly, how do I delete a specific coursework from the larger collection?

Any help is appreciated..

You can select an individual subdocument using the .id() method of a document array. Therefore, assuming an existing course document called course:

var coursework = course.coursework.id('id-of-coursework');

This document can then be deleted using:

coursework.remove();

Note that you must save the parent course document to persist changes to subdocuments.