title: How to fix deleteOne() function of a mongoose model when it does not delete by req.params.id?
body: <p>Firstly to be mentioned, I'm absolutely new to Node.Js and MongoDB.</p>
  
  <p>I'm coding a back end API with Node.Js and MongoDB which will deal with GET, POST, DELETE requests from the front end, quite simple stuff. </p>
  
  <p>I'm stuck while working with DELETE functionality. </p>
  
  <p>Here is my <strong>posts.service.ts</strong> file contains this <strong>deletePost()</strong> function which sends the postId to the back end <strong>app.js</strong> file. </p>
  
  <p>`</p>
  
  <pre><code>deletePost(postId: string) {
      this.http.delete('http://localhost:3000/api/posts/' + postId)
      .subscribe(() =&gt; {
        console.log(postId);
        console.log('Deleted');
      });
    }
  </code></pre>
  
  <p>`</p>
  
  <p>I have added this <strong>console.log(postId)</strong> to check whether it is actually containing the actual postId and found that it does. I have also matched it with the real Id in MongoDB by checking through mongo shell. </p>
  
  <p>Here is the <strong>delete()</strong> function in the back end <strong>app.js</strong> file that should do the actual task.</p>
  
  <p>`</p>
  
  <pre><code>app.delete("/api/posts/:id", (req, res, next) =&gt; {
    Post.deleteOne({ _id: req.params.id }).then(result =&gt; {
      console.log(result);
      res.status(200).json({message: "Post deleted"});
    });
  });
  </code></pre>
  
  <p>`</p>
  
  <p>The <strong>console.log(result)</strong> line should print some result in the terminal, but it does not, so does not it delete the collection in the DB. </p>
  
  <p>I`m running this on an Ubuntu 16.04 LTS pc. </p>
  
  <p>Some clue would mean great help. Thank you very much for your kind effort.</p>