Reputation: 3525
There is a way to avoid duplicate files in mongo gridfs? Or I have to do that via application code (I am using pymongo)
Upvotes: 5
Views: 2984
Reputation: 36784
The MD5 sum is already part of Mongo's gridfs meta-data, so you could simply set a unique index on that column and the server will refuse to store the file. No need to compare on the client side.
Upvotes: 5
Reputation: 7343
You could use md5 hash and compare new hash with exists before saving file.
Upvotes: 1