MongoDB GridFS 存储桶?

发布于 2024-10-03 11:43:17 字数 516 浏览 1 评论 0原文

我使用 MongoDB C# Samus 驱动程序

MongoDB.GridFS.GridFile 类的构造函数之一具有参数“bucket”。当我在Java中创建GridFile时,例如 示例我无法设置这个“桶”。但我可以在创建GridFS对象时在Java中设置这个“桶” Java 文档。我很困惑!

我的问题:

什么是“桶”?为了什么?请告诉一些用例;)

I work with MongoDB C# Samus driver.

One of constructors of class MongoDB.GridFS.GridFile has parameter "bucket". When i create GridFile in Java like example i cannot set this "bucket". But i can set this "bucket" in Java when create GridFS object Java documentation. I'm confused!

My question:

What is "bucket"? For what? Tell please some use cases;)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无声情话 2024-10-10 11:43:17

Bucket 是文件和块集合的基本名称。默认情况下,存储桶是“fs”,因此您将有两个集合:

  • fs.files 将存储文件属性,如 id、名称、大小、块大小、md5 校验和等。
  • fs.chunks 将存储分割成块的实际二进制数据,每个块一个文档。

使用 GridFS 类构造函数参数,您可以设置任意存储桶名称。

如果您需要为不同类型的文件提供单独的集合,则不同的存储桶会很有用,这样您就可以应用不同的索引、分片等。

Bucket is base name for files and chunks collections. By default bucket is 'fs' so you will have two collections:

  • fs.files will store file properties like id, name, size, chunk size, md5 checksum etc.
  • fs.chunks will store the actual binary data split into chunks, one per document.

Using GridFS class constructor argument you can set arbitrary bucket name.

Different buckets can be useful if you need to have separate collections for different types of files, so you can apply different indexes, sharding etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文