How to remove a file from both chunks and files in GridFS? How to remove a file from both chunks and files in GridFS? mongoose mongoose

How to remove a file from both chunks and files in GridFS?


I just did this recently using gridfs-stream

Then the gfs driver does it for you:

gfs.remove(options, function (err) {  if (err) return handleError(err);  console.log('success');});

or

gfs.remove({ _id: fileId });