aheckmann / gridfs-stream

Easily stream files to and from MongoDB
MIT License
615 stars 120 forks source link

Remove method has stopped working #149

Open arnavzek opened 4 years ago

arnavzek commented 4 years ago

gfs.remove({filename: filename},(err, gridStore)=>{})

Gives the following error

(node:7440) DeprecationWarning: collection.remove is deprecated. Use deleteOne, deleteMany, or bulkWrite instead.
avichal-neweradeveloper commented 3 years ago

They have not updated it according to mongoose and no other method for deleting such as deleteOne, deleteMany are not available. They must update it soon.

shivamraina commented 2 years ago

If it will help someone, I deleted using this

const bucket = new mongodb.GridFSBucket(conn.db, { bucketName: 'uploads' });
bucket.delete(ObjectId("60edece5e06275bf0463aaf3"));