I'm trying to delete both .files and .chunk data but all the posts that I have found are either outdated or do not apply to my issue.
This is my backend route:
const mongoose = require("mongoose");
const config = require("config");
const db = config.get("mongoURI");
let gfs;
const conn = mongoose.createConnection(db);
conn.once("open", () => {
gfs = new mongoose.mongo.GridFSBucket(conn.db, {
bucketName: "photos"
});
});
router.delete('/:imageID', async (req, res) => {
gfs.delete({_id: req.params.imageID, root:"photos"}, function(error){
test.equal(error, null);
}
Any ideas?