title: mongoose - remove element in array using $pull
body: <p>I have a node object that looks like this:</p>
  
  <pre><code>{
     "_id":"58b336e105ac8eec70aef159",
     "name":"my node",
     "ip":"192.168.1.1",
     "__v":0,
     "configuration":{
         "links":[
           {
              "linkName":"athena_fw_listen_tcp_5555",
              "_id":"58b336e105ac8eec70aef15d",
              "local":true
           },
           {
              "linkName":"athena_fw_listen_udp_5554",
              "_id":"58b336e105ac8eec70aef15c",
              "local":true
           }
        ]
     }
  }
  </code></pre>
  
  <p>I am sending a delete request to my express server that looks like this:
  <code>DELETE http://localhost:9000/api/nodes/58b336e105ac8eec70aef159/links/58b336e105ac8eec70aef15d</code></p>
  
  <p>I followed instructions in <a href="https://docs.mongodb.com/manual/reference/operator/update/pull/" rel="noreferrer">$pull mongodb documentation</a> and I also tried <a href="https://stackoverflow.com/questions/9048424/removing-specific-items-from-array-with-mongodb">this</a></p>
  
  <p>But it does not seem to work, as I keep receiving: <code>500 (Internal Server Error)</code></p>
  
  <p>This is how the code on my express side looks like:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>exports.destroyLink = function(req, res) {
      Node.findById(req.params.id, function(err, node) {
          if (err) { return handleError(res, err); }
          if (!node) { return res.status(404).send('Not Found'); }
          console.log("Node", JSON.stringify(node))
          console.log("Params", req.params)
  
          node
              .update({ '_id': req.params.id }, { $pull: { 'configuration': { 'links': { '_id': req.params.linkId } } } }, false, true)
              .then(err =&gt; {
                  if (err) { return handleError(res, err); }
                  return res.status(204).send('No Content');
              });
      })
  };</code></pre>
  </div>
  </div>
  </p>
  
  <p>The express router contains this:
  <code>router.delete('/:id/links/:linkId', controller.destroyLink);</code></p>
  
  <p>So I am expecting id and linkId as params, I use id (<code>_id: req.params.id</code>) to target a specific node and linkId (<code>_id: req.params.linkId</code>) to target a specific link, but it doesn't work!</p>
  
  <p>Need help resolving the issue, I don't know what I am missing here!</p>