Open heinhoang opened 7 years ago
me too. I'm trying to find a way to delete all files in one shot.
This is due to the fact that the .remove()
function must take at least _id
or filename
as parameter as per the documentation.
https://github.com/aheckmann/gridfs-stream/blob/8fe8c845a194dc0caeb75db598fad63f998d1e8f/lib/index.js#L81
You could make a pull request with a new Grid function to clear either the current or a specific collection.
If you want to do it without adding a new function, you can also do Grid.files.remove({})
. Be aware that it will remove all documents from the current collection. In case you want to do it on a specific collection, you should use Grid.collection('name').remove({})
.
How can one
This is due to the fact that the
.remove()
function must take at least_id
orfilename
as parameter as per the documentation. https://github.com/aheckmann/gridfs-stream/blob/8fe8c845a194dc0caeb75db598fad63f998d1e8f/lib/index.js#L81You could make a pull request with a new Grid function to clear either the current or a specific collection.
If you want to do it without adding a new function, you can also do
Grid.files.remove({})
. Be aware that it will remove all documents from the current collection. In case you want to do it on a specific collection, you should useGrid.collection('name').remove({})
.
Can you delete multiple files at once
Hi I need to delete many files in single request gfs.files.deleteMany({_id: { $in: req.params.ID }}, (err, result) => {......})
Whether deletemany is possible...please show me the correct format
I tried this but not works: