MongoDB:嵌入性能问题
我刚刚开始学习 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,这是一个糟糕的设计。每次都使用嵌入式文档来增长内容是一个糟糕的设计。文件的限制是由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.