title: How can I update an element in array that is an object in array inside mongoDb with mongoose
body: <p>I have a mongodb collection that contains this type of structure.</p>
  
  <p><code>
      modules: [
          { 
              systems:[
                { systemId: 13, count: 2 },
                { systemId: 20, count: 7 },
                { systemId: 8, count: 1 }
              ]
          },
          { 
              systems:[
                { systemId: 13, count: 2 },
                { systemId: 20, count: 7 }
              ]
          }
      ]
  </code></p>
  
  <p>what I am trying to do is <code>update</code> every <code>module</code> that contains a <code>system</code> with <code>systemId = 13</code> and <code>$set</code> that entire system to <code>{d: null}</code></p>
  
  <p>so that it looks like this afterwards:</p>
  
  <p><code>
      modules: [
          { 
              systems:[
                { d: null },
                { systemId: 20, count: 7 },
                { systemId: 8, count: 1 }
              ]
          },
          { 
              systems:[
                { d: null },
                { systemId: 20, count: 7 }
              ]
          }
      ]
  </code></p>