node.js - Create, Update and Delete arrays within arrays in mongoose -


I have a schema like below.

  course: [{institution: string, from: date, date: date, aggregate session: string, coursework: [{semestername: string, score: string, from: date, date:] }}   

I know how to add a new course, but how do I value the value of a particular research based on the _id prepared by each coursework? Can I update when there are many text-list items? In addition, similarly, how do I remove a special research from the large collection?

Any help is appreciated ..

You can select an individual sub-document using the .id () method. Therefore, assuming an existing course document called course :

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

This document can be deleted again:

  coursework.remove ();   

Note that you will have to save the parent code course to continue the changes in sub-documents.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -