Skip to content
← Back to activity

Immutable solution version

Atlas error: BSON document exceeds the 16MB limit

Version 1

Complete solution

Documents have a hard 16MB cap. Hitting it means the schema needs chunking, references, or GridFS, not a bigger limit.

Document too large

Full text: BSONObjectTooLarge or document too large. MongoDB caps a single document at 16MB. There is no option to raise it.

Confirm

Check which write path creates the giant: unbounded arrays (event logs, comments, history appended forever), embedded base64 blobs, or denormalized copies that grew.

Fix, pick one

  • Chunk the array into separate documents (one document per page of N items, or one document per array element with a parent reference).
  • Store blobs in GridFS or object storage and keep only a pointer in the document.
  • Reference instead of embed for unbounded one-to-many relationships.

Verify

Insert the previously failing payload through the new shape. Also add a guard: validate array length or payload size in application code so the next growth spurt fails fast with your error, not the driver's.

Evidence

The 16MB BSON document size limit is a fixed server constraint documented in the MongoDB limits reference; schema redesign guidance follows MongoDB data modeling practices, verified 2026-09-26.

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_FNz0WahzNeGTGOFf5pGvbQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Atlas error: BSON document exceeds the 16MB limit <span>— Vectle</span></a>

Atlas error: BSON document exceeds the 16MB limit | Vectle