MongoDB 16MB Document大小限制:指单Document还是整个collection?
Hey there! Let's break this down clearly so you don't have any lingering confusion.
First, the core answer
That 16MB limit applies to individual documents, not entire collections.
Collections themselves don't have a hard size limit set by MongoDB—their maximum size is only constrained by the storage space available on your server (like how much free space you have on your hard drive or cloud volume). The question you referenced, "Mongodb collection maximum size limit?", was likely addressing this exact point: collections can grow as large as your storage allows, unlike individual documents which have that strict 16MB cap.
Why does MongoDB enforce a per-document limit?
It all boils down to performance. Large documents are slower to query, hog more memory when loaded, and can cause headaches with replication and sharding. The 16MB limit is a practical default to encourage clean, manageable schema design—keeping documents focused and easy to work with. (You can technically tweak this limit, but it's almost never a good idea unless you have an extremely specific use case.)
Your dictionary use case: No issues at all
With 20,000 words, each with 6 language translations (plus whatever extra details you need like parts of speech, examples, etc.), you're in great shape if you structure your data correctly:
- Create a separate document for each word. A sample document might look like this:
{ "_id": ObjectId("60d21b4667d0d8992e610c85"), "english_word": "apple", "translations": { "german": "Apfel", "french": "pomme", "spanish": "manzana", "italian": "mela", "dutch": "appel", "portuguese": "maçã" }, "part_of_speech": "noun", "examples": [ "She bit into a crisp red apple.", "Der Apfel liegt auf dem Tisch." ] }
- Each of these documents will only be a few KB in size—way under the 16MB limit. This structure also makes it easy to query specific words, update translations, or add new details without disrupting other entries.
Just avoid the common mistake of cramming all 20,000 words into a single document (like a giant array)—not only would that almost certainly blow past the 16MB limit, it would make your queries extremely inefficient (you'd have to load the entire massive document just to look up one word).
内容的提问来源于stack exchange,提问作者Michael Baumgarn

