How to delete document by _id using MongoDB and Jade (Express.js)?
<p>I have successfully set up a database using mongodb, and I have managed to add new entries to my collection. However, when I use a similar method to delete, nothing happens.</p>

<p><strong>Express.js code</strong></p>

<pre><code>router.post('/deleteproject', function(req, res) {
var MongoClient = mongodb.MongoClient;

var url = 'mongodb://localhost:27017/plugd';

MongoClient.connect(url, function(err, db) {
    if (err) {
        console.log("Unable to connect to server", err);
    } else {
        console.log('Connected to server');

        var collection = db.collection('projects');

        collection.remove(
            {_id: new mongodb.ObjectID(req.body)}, function(err, result) {
            if (err) {
                console.log(err);
            } else {
                res.redirect("thelist");
            }
            db.close();
        });
    }
});
</code></pre>

<p>});</p>

<p><strong>Jade code</strong></p>

<pre><code>h2.
ul
    Projects
    each project, i in projectlist
        #project_list_item
            a(href='#') #{project.owner} - #{project.project} 
            p #{project.ref1} 
            p #{project.ref2} 
            p #{project.ref3}
            form#form_delete_project(name="deleteproject", method="post", action="/deleteproject")
            input#input_name(type="hidden", placeholder="", name="_id", value="#{project._id}")
            button#submit_project(type="submit") delete
</code></pre>