Free tools Windows power users keep installed
One-click scans. No signup required.
If a MongoDB-backed agent run fails while saving or returning data, rank the documents in the affected collection by their encoded BSON size. MongoDB caps each BSON document at 16 mebibytes (MiB); a smaller cursor batch does not change that per-document limit. In mongosh, use $bsonSize on $$ROOT and return only each document’s _id and byte count to identify the largest stored records.
Find the largest stored documents
Run this aggregation against the collection involved in the failed operation, replacing collection with its name:
As an Amazon Associate I earn from qualifying purchases.
db.collection.aggregate([
{
$project: {
_id: 1,
bsonBytes: { $bsonSize: "$$ROOT" }
}
},
{ $sort: { bsonBytes: -1 } },
{ $limit: 20 }
])
$bsonSize returns the size in bytes of an object encoded as BSON. Here, $$ROOT means the current document; the pipeline projects a compact row containing its identifier and size, sorts largest first, and limits the output to 20. See MongoDB’s $bsonSize documentation.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesUse the relevant filter as well if you can narrow the scan to the records involved in the failing agent operation. The results can tell you which stored documents are largest, but not which one caused a particular failure without matching them to the operation and error details.
#1 Best Overall
If the failing document is not in the collection
A collection scan cannot find a document that was rejected before insertion or whose failed update was never applied. In that case, capture the pending payload at the application’s write path and measure the object being sent. The aggregation ranks only documents currently present.
What the 16 MiB limit applies to
MongoDB’s Database Manual states: “The maximum BSON document size is 16 mebibytes.” The limit applies to the encoded document as a whole, including embedded objects and arrays. A large nested value or growing embedded list can therefore push the containing document over the cap even if no single field appears unusually large.
The aggregation itself must also obey the per-result-document limit. Keep diagnostic output compact: projecting an identifier and byte count avoids building a large result document while measuring the originals. See MongoDB’s aggregation pipeline limits.
Separate a document-size error from a cursor-batch limit
MongoDB also limits a cursor batch to at most 16 MiB in total, but that is a separate constraint from the maximum size of one BSON document. A batch contains documents; each document is independently subject to the 16 MiB cap. Reducing batch size may affect how many results arrive together, but it cannot make an oversized document valid. MongoDB describes the distinction in its limits documentation and cursor documentation.
Rank #3
Check whether the failure is in MongoDB Search replication
If ordinary reads and writes work but Search indexing stalls or replication lag grows, the oversized object may be a change-stream event rather than a stored document. A change event includes metadata as well as document data, so an update to an already-large document can produce an event that exceeds the BSON limit.
For self-managed MongoDB Search, inspect mongot logs and the documented metrics. MongoDB identifies messages such as change-stream payload exceeding 16MB BSON limit, BSONObjectTooLarge, Executor error during getMore, and code 10334 as relevant clues. Its Search troubleshooting guidance discusses reducing document size, avoiding large updates where possible, replacing a document rather than applying a large update where appropriate, and reducing update-event metadata. This diagnosis applies when symptoms point to Search indexing; it is not a general explanation for every failed agent run.
Rank #4
Choose a repair that fits the data
Once you identify the oversized record—or establish that the rejected payload never reached the collection—change the data shape or storage location that is driving its size. MongoDB’s guidance on unbounded arrays and its data modeling documentation describe ways to structure related data.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11- Growing embedded arrays: If a document accumulates an unbounded list, consider splitting the list into smaller documents and referencing related records. Patterns such as subset or outlier designs may help when they suit how the application reads the data.
- Images and bulky assets: When practical, keep large images or other assets outside the database deployment and store references in MongoDB. Including bulky assets in documents makes the document cap easier to reach.
- Content larger than one document: MongoDB points to GridFS for content that must exceed the BSON document maximum. See the GridFS documentation.
- Frequently accessed data: If the application usually fetches fields together, keep that access pattern in view when deciding what to embed or separate. Referencing data can reduce document size, but it changes how the application retrieves related information.
If the size scan does not explain the incident, preserve the failing operation and full error details; the exact cause cannot be determined from the limit alone. Confirm whether the failure occurred on insert, update, read, or Search indexing before choosing a repair.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




