I'm trying to delete something but the current format below doesn't work.
It works when I input it manually and write "_id":ObjectId("Idhere")
. It doesn't even work when I use JSON.stringify
. It also works in postman.
Does someone see what I'm missing?
router.delete('/wishlist', (req, res) => {
const db = mongoUtil.getDb();
db.db("mern-auth-2").collection("savedbooks").deleteOne({
_id:ObjectId(req.body._id),
})
});