title: When child document is deleted, how to delete its reference inside parent document in Mongoose?
body: <p>In Mongoose, I have a parent document that has an array of child references.</p>
  
  <p>Subject has many Topics:</p>
  
  <pre><code>Inside Subject.js:
  const SubjectSchema = new Schema({   
    topics: [{
      type: Schema.Types.ObjectId,
      ref: 'topic'
    }]
  ...
  </code></pre>
  
  <p>When I delete a topic, I would like its reference removed from Subject.topics array.</p>
  
  <p>Any help will be appreciated!</p>