gridfs-stream icon indicating copy to clipboard operation
gridfs-stream copied to clipboard

Remove method has stopped working

Open Arnav-Kushesh opened this issue 5 years ago • 2 comments



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

Gives the following error

(node:7440) DeprecationWarning: collection.remove is deprecated. Use deleteOne, deleteMany, or bulkWrite instead.

Arnav-Kushesh avatar Aug 13 '20 09:08 Arnav-Kushesh

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.

avichal-neweradeveloper avatar Jan 02 '21 03:01 avichal-neweradeveloper

If it will help someone, I deleted using this

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

shivamraina avatar Mar 27 '22 18:03 shivamraina