title: MongoDB -- Remove null values in objects inside array
body: <p>I have a sample document with array of objects</p>
  <pre><code>[
    { 
      array_a: [{&quot;key1&quot;: &quot;val1&quot;, &quot;key2&quot;: &quot;val2&quot;, &quot;key3&quot;: null}, ...],
      array_b: [{&quot;key4&quot;: &quot;val1&quot;, &quot;key5&quot;: null, &quot;key6&quot;: null}, ...]
    }, 
    ... 
  ]
  </code></pre>
  <p>How can I remove the keys with null value? To become:</p>
  <pre><code>[
    { 
      array_a: [{&quot;key1&quot;: &quot;val1&quot;, &quot;key2&quot;: &quot;val2&quot;}, ...],
      array_b: [{&quot;key4&quot;: &quot;val1&quot;}, ...]
    }, 
    ... 
  ]
  </code></pre>