title: MongoDB - Pull multiple objects from an array
body: <p>Hi I'm trying to remove multiple objects from an array that looks like this.</p>
  <pre><code>{
  &quot;_id&quot; : ObjectId(&quot;5a7da1bda21d5f3e8cf005b3&quot;),
  &quot;owner&quot; : &quot;1&quot;,
  &quot;group_name&quot; : &quot;PAASCU Board&quot;,
  &quot;group_members&quot; : [ 
      {
          &quot;faculty_name&quot; : &quot;Cheska Dela Rosa&quot;,
          &quot;faculty_number&quot; : 2,
          &quot;_id&quot; : ObjectId(&quot;5a7da1bda21d5f3e8cf005b5&quot;)
      }, 
      {
          &quot;faculty_name&quot; : &quot;Earl Sempio&quot;,
          &quot;faculty_number&quot; : 7323,
          &quot;_id&quot; : ObjectId(&quot;5a7da1bda21d5f3e8cf005b4&quot;)
      }, 
      {
          &quot;faculty_number&quot; : 203,
          &quot;faculty_name&quot; : &quot;Sample&quot;,
          &quot;_id&quot; : ObjectId(&quot;5a7dbf7952bd150a94d83958&quot;)
      }, 
      {
          &quot;faculty_number&quot; : 8025,
          &quot;faculty_name&quot; : &quot;Sample Postman&quot;,
          &quot;_id&quot; : ObjectId(&quot;5a7dc64a1cf5dd3d50167d53&quot;)
      }
  ],
  &quot;__v&quot; : 0 }
  </code></pre>
  <p>It works when I remove a single object using the <a href="https://docs.mongodb.com/manual/reference/operator/update/pull/" rel="noreferrer">$pull</a> with this code.</p>
  <pre><code>db.getCollection('groups').update({_id: ObjectId(&quot;5a7da1bda21d5f3e8cf005b3&quot;)}, {$pull: {&quot;group_members&quot;: {&quot;faculty_number&quot;:8025}}})
  </code></pre>
  <p>But what if I want to remove multiple objects with different <code>faculty_number</code>? I tried using the <code>$each</code> method just like how I add multiple objects in the array but it doesn't work well.</p>