I'm wondering if you had something like a list and a subdocument of items. Does MongoDB save them all as a single document, or does MongoDB regard the subdocuments as independent documents. This is in regard to the 16mb document limit.


list document:

  items: [
      _id: 1
      name: "item1"
      _id: 2
      name: "item2"
      _id: 3
      name: "item3"
  • Does MongoDB save them all as a single document, Yes.
    – Laiv
    Sep 4, 2018 at 6:52
  • @Laiv thanks, then my change of approach will not have been for nothing
    – A. L
    Sep 4, 2018 at 7:00
  • @Laiv can you provide any reference for this claim ? Because several sources claim that nested documents zre taken into account. Fir example: stackoverflow.com/a/19401813/3723423
    – Christophe
    Sep 4, 2018 at 7:29
  • @Christophe I'm agreeing with you. Nested documents are taken into account regarding the document total size, because at the end, for mongo there's no such thing as "subdocument" or "nested document". It's a single document. Unless you use DBRef, but these are addressed to provide support to a handful MongoDB drivers. To these cases, the size of the referenced document is not taken into account.
    – Laiv
    Sep 4, 2018 at 8:12

1 Answer 1


MongoDb manages json documents in a binary bson format. In particular, bson is used to store documents in the database and exchange the documents with the outside world.

Document with embedded/nested documents will be stored in a bson object that contains all its elements, including the nested ones. There is no automatic disassembling and reassembling. In fact, all the access to the nested documents will go through the owning document.

The 16 MB limit is meant to facilitate the management of documents in memory and in remote function calls. It therefore applies to the whole bson document including all its nested elements. There's by the way a limit of 100 to the nested depth.

More information:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.