mongodb - MongoDB GridFS 中是否维护 CRUD 操作的原子性?

标签 mongodb crud gridfs atomic

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/

相关文章:

synchronization - 离线同步和事件溯源

r - 在 R Shiny 中实现 CRUD 工作流的最简洁方法是什么?

javascript - 我如何使用 Node js 从 mongodb 集合中获取单个字段值

mongodb - 查询 : redis or mongodb?

android - 制作 Node.js 服务器的独立解决方案

javascript - 使用 Javascript 上传个人资料图片

r - 更新 MongoDB 中的多个文档 (rmongodb)

python - 如何使用 gridfs 检索文件

c# - Mongo 'find' 方法不适用于 DateTime.MinValue

python - GridFS.put() 和 GridFSBucket.upload_from_stream() 的区别