Native mongodb
biblioteket behöver _id
vara ObjectId
Slutresultatet skulle se mer-mindre ut så här:
var mongo = require('mongodb');
// Other code lines
router.delete('/formula-list/:id', function(req, res){
var db = req.db.collection('formulas');
var query = { "_id": new mongo.ObjectId(req.params.id) };
db.deleteOne(query, function(err, r){
assert.equal(null, err);
assert.equal(1, r.deletedCount);
db.close();
});
res.end();
});