Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
There is a way to avoid duplicate files in mongo gridfs? Or I have to do that via application code (I am using pymongo)
MD5 和已经是 Mongo 的 gridfs 元数据的一部分,因此您可以简单地在该列上设置唯一索引,服务器将拒绝存储该文件。无需在客户端进行比较。
您可以在保存文件之前使用 md5 哈希并将新哈希与存在进行比较。