When we are upgrading AEM 6.1 instance with mongo (Mongo version: 2.6 ) to AEM 6.3 with mongo (Mongo version: 3.2) we are facing the exception.

org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore Background operation failed: org.bson.BsonSerializationException: Document size of 29344731 is larger than maximum of 16777216.

How DocumentNodestore exceeds its limit? Is there anyway to resolve the issue? Is revision garbage collection will reduce the DocumentNodeStore size?

  • As per MongoDB documentation the maximum BSON document size is 16 megabytes. If you want to store more than 16 MB size of document in MongoDB. Then use the GridFS. Mar 30, 2018 at 19:37

1 Answer 1


As per MongoDB BOL here The maximum BSON document size is 16 megabytes.

The maximum document size helps ensure that a single document cannot use excessive amount of RAM or, during transmission, excessive amount of bandwidth. To store documents larger than the maximum size, MongoDB provides the GridFS API.

GridFS is a specification for storing and retrieving files that exceed the BSON-document size limit of 16 MB.

For your further ref here and here

  • 1
    I'm a new user. No matter how you wrap it, this s*cks. Feb 14, 2020 at 19:41
  • What's worse--Mongo lets you write huge documents but not read them back into RAM
    – duhaime
    Dec 20, 2020 at 22:11
  • @duhaime - do you have a reference for that? It would explain the error I'm encountering, but seems ridiculous they would enforce that on read rather than on write! Aug 16, 2021 at 20:40
  • @Kyrstellaine I don't have a reference but it should be easy enough to write a ~1GB document then query for it. If the write succeeds but the read fails you have your answer!
    – duhaime
    Aug 17, 2021 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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