mongo-dart / mongo_dart

Mongo_dart: MongoDB driver for Dart programming language
https://pub.dev/packages/mongo_dart
MIT License
446 stars 98 forks source link

How to properly delete a GridFS file? #320

Closed busslina closed 1 year ago

busslina commented 1 year ago

I didn't found any analog method to delete a file like createFile.

giorgiofran commented 1 year ago

Funnily enough, there is no delete method ... You can use the standard delete methods in the gridFS files (see the gridFS_test as example, or, if it is not urgent, I will prepare a convenient method for deleting those files.

busslina commented 1 year ago

@giorgiofran Thank you. I will try to use "old way" and if one day you create that convenient method, if you can advice here in this issue I will appreciate

giorgiofran commented 1 year ago

I have published version 0.9.1 with a simple delete method. Please, give it a try and let me know if it fits your needs.

JohnF17 commented 1 year ago

Well, all I can say is the author of this issue and many more will well appreciate this update. And For me personally, I was looking forward to its implementation and you certainly delivered, thanks a bunch @giorgiofran!

P.s Its not worth making a new issue so i'll say it here, there's a _typo on the gridfs_test example_ where GridFs.defaultChunkSize is set to 9, 3, 4 the like... which is in bytes 💀 and that's really gonna mess up upload speeds and download speeds for people who would look at the example and copy it (rightfully so), meanwhile the actual the *defaultChunkSize is set to 256 1024 which is about 2mb and is good enough, so fixing that typo or little error would be nice** i recon (if i'm not wrong). Cheers! 🙂

busslina commented 1 year ago

@giorgiofran I can confirm it works great. Thank you again

giorgiofran commented 1 year ago

P.s Its not worth making a new issue so i'll say it here, there's a _typo on the gridfs_test example_ where GridFs.defaultChunkSize is set to 9, 3, 4 the like... which is in bytes 💀 and that's really gonna mess up upload speeds and download speeds for people who would look at the example and copy it (rightfully so), meanwhile the actual the *defaultChunkSize is set to 256 1024 which is about 2mb and is good enough, so fixing that typo or little error would be nice** i recon (if i'm not wrong). Cheers! 🙂

Please, consider that the gridfs_test is not intentend to be an example, but just a test. So, the idea was to produce more than one chunk even with a small List. That is why there are those values. But I agree that in the example, we should at least provide a comment to explain this.

JohnF17 commented 1 year ago

So, the idea was to produce more than one chunk even with a small List.

Hmm, okay that explains it a lot.

But I agree that in the example, we should at least provide a comment to explain this.

That is a viable option indeed!🙂