title: MongoDB .deleteOne not working in Node.js
body: <p>So, i'm trying to delete a document when a button is pressed. The button code looks like this:</p>
  <pre><code>&lt;form action=&quot;/patients/delete?_method=DELETE&quot; method=&quot;POST&quot;&gt;
      &lt;input type=&quot;hidden&quot; id=&quot;patientID&quot; name=&quot;patientID&quot; value=' _id: &lt;%= patient._id%&gt;'&gt;
      &lt;button type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&gt;Delete this patient from the Database&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  <p>I've set up a route which looks like this:</p>
  <pre><code>router.delete('/delete', AuthControl.checkLoggedIn, patientsControl.patientDelete);
  </code></pre>
  <p>Which is calling this function in patientsControl:</p>
  <pre><code>    patientDelete = async (req, res) =&gt; {
      let DeleteParam = req.body.patientID;
      console.log(DeleteParam);
      let DeleteConfirm = await this.patientsModel.DeletePatient(DeleteParam);
      if (DeleteConfirm) {
          res.render('patients');
      } else {
          console.log(&quot;Error happening somewhere&quot;);
          }
      }
  </code></pre>
  <p>which is calling this function in the patientsModel:</p>
  <pre><code>async DeletePatient(DeleteParam) {
      return mongoose.connection.db.collection(&quot;PatientsDB&quot;).
      deleteOne({ _id : DeleteParam);
  }
  </code></pre>
  <p>//EDIT: quickly fixed the above code, wasn't what I was running
  Which is returning true, as I'm not logging an error in patientDelete above.</p>
  <p>the console.log(DeleteParam); is returning the id for the document i'm trying to delete, like this:
  <code>5f22dc43b1e72e9769263810</code></p>
  <p>and the document im trying to delete looks like this:</p>
  <pre><code>_id : 5f22dc43b1e72e9769263810
  fName : &quot;s&quot;
  lName : &quot;s&quot;
  diseases : &quot;s&quot;
  prescriptions : []
  inhousedoctor : &quot;s&quot;
  </code></pre>
  <p>What confuses me is, that if i set the button value to &lt;%= patient.fName %&gt; instead, it deletes perfectly. Can anyone please tell me what i'm doing wrong?</p>
  <p>Edit: Ofc I mean that it works when i use fName instead like this:</p>
  <pre><code>        return mongoose.connection.db.collection(&quot;PatientsDB&quot;).
          deleteOne( {fName : DeleteParam});
      }```
  </code></pre>