开发者

MongoDB: embedding performance question

开发者 https://www.devze.com 2023-02-02 18:34 出处:网络
I ju开发者_如何学编程st started learning MongoDB, and I really like the idea of embedding collections instead of referencing them.

I ju开发者_如何学编程st 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消