GridFS 将数据 block 存储在 fs.chunks
中,将元数据存储在 fs.files
中。因此,在单个事务中它管理两个集合。所有 CRUD 操作都保证原子性吗?
最佳答案
这就是MongoDB FAQ说:
Do not use GridFS if you need to update the content of the entire file atomically. As an alternative you can store multiple versions of each file and specify the current version of the file in the metadata. You can update the metadata field that indicates “latest” status in an atomic update after uploading the new version of the file, and later remove previous versions if needed.
关于mongodb - MongoDB GridFS 中是否维护 CRUD 操作的原子性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29386355/