title: Removing an element from array in mongodb
body: <p>I want to remove a specific element from array stored in mongodb document.
  I am using this:</p>
  
  <pre><code> model.registerCompany.findOneAndUpdate({companyKey:"a key"},
      {$pop:{onlineEmployees:"John"}},
      function(err,doc){
      if(!err)
          console.log("Online list modified: ",doc);
      else
          console.log("Online list modified error :",err);
  });
  </code></pre>
  
  <p>But I am not sure if the $pop removes the specific element "John" from array(onlineEmployees) or just pop out the last element from it.
  <br><br>Am i doing it right or there is another way to do it.?
  <br><br>
  I think i got the answer .. $pull is used for this purpose as explained here in the link:
  <a href="http://docs.mongodb.org/manual/reference/operator/pull/#_S_pull" rel="nofollow">http://docs.mongodb.org/manual/reference/operator/pull/#_S_pull</a> </p>