MongoDB:嵌入性能问题

发布于 2024-10-10 02:06:36 字数 207 浏览 0 评论 0原文

我刚刚开始学习 MongoDB,我真的很喜欢嵌入集合而不是引用它们的想法。

如果需要性能,MongoDB 的文档建议使用嵌入。

我只是想到了一个简单的论坛模型。比方说,每个图板类别都有多个图板,每个图板有多个主题,每个主题有多个消息。所有这些集合都是嵌入的。

一段时间后,董事会类别的规模将变得巨大。远远超过 2MB 限制。这是否意味着这个设计有缺陷?

I just started learning MongoDB, and I really like the idea of embedding collections instead of referencing them.

MongoDB's documentation recommends to use embedding if performance is needed.

I just thought about a simple forum model. Let's say, every board category has several boards, every board has several topics, and every topic has several messages. All of these collections are embedded.

After some time the size of the board category will be huge. Way more than the 2MB limit. Does this mean that there's a flaw in this design?

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

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

发布评论

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

评论(1

初吻给了烟 2024-10-17 02:06:36

是的,这是一个糟糕的设计。每次都使用嵌入式文档来增长内容是一个糟糕的设计。文件的限制是由mongoDB维护者做的,以避免这个文件的增加。

Yes it's a bad design. Using a Embedded document to something grow every time is a bad design. The limit of document is do by mongoDB mainteneur to avoid this document increase.

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