Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

350
Views
UnhandledPromiseRejectionWarning: TypeError: No se puede leer la propiedad 'desvincular' de undefined en Grid.remove

Estoy tratando de eliminar un archivo por su ID usando gridfs, pero recibo este error cuando llamo a la API de eliminación.

Controlador :

 let gfs; connect.once("open", () => { gfs = Grid(connect.db, mongoose.mongo); gfs.collection("uploads"); }); exports.deleteFile = (req, res) => { try { gfs.remove( { _id: req.params.id, root: "uploads" }, (err, gridStore) => { if (err) { return res.status(404).send({ message: err }); } else { return res.send({ message: "File deleted successfuly" }); } } ); } catch (error) { return res.status(500).send({ message: error.message, }); } };
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

exports.deleteFileByFilename = async (req, res, next) => { const file = await gfs.files.findOne({ filename: req.params.filename }); const gsfb = new mongoose.mongo.GridFSBucket(conn.db, { bucketName: 'uploads' }); gsfb.delete(file._id, function (err, gridStore) { if (err) return next(err); res.status(200).end(); }); };
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!