title: removing element of an array that with a match of certain element
body: <p>I have a mongodb collection.</p>
  
  <blockquote>
    <p>{ user_id: 1,
      items : [ { _id: 1 }, { _id: 2}, {_id:3} ] }</p>
  </blockquote>
  
  <p>I want to remove the items of the array having specific id. Can anybody explain what is wrong with the above query.</p>
  
  <pre><code>db.col.findOneAndUpdate({user_id:1},{$pull:{items:{$elemMatch:{_id:2}}}})
  </code></pre>