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.
是否可以在 mongo 中对读写进行随机访问?
是的。MongoDB 允许以任何顺序读取和写入文档(以及文件)。
可以使用文档(块)粒度(默认为 256k)进行随机访问。您可以独立读取/写入这些块。
GridFS 文件元数据和块存储在常规集合中(通常称为 fs.files 和 fs.chunks)。如果您愿意,您也可以在非常低的级别上自己阅读和编写这些文档。一些驱动程序为 GridFS 文件提供类似流的接口,包括随机访问。您使用的是哪个驱动程序?