# MongoServerError: BSONObj 大小：17825792 (0x1100000) 无效。大小必须在 0 到 16793600(16MB) 之间。第一个元素：_id: ObjectId('...')

- **ID:** `database/mongodb-document-too-large`
- **领域:** database
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 85%

## 根因

插入或更新的文档超过了 MongoDB 的 16MB BSON 文档大小限制。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| MongoDB 6.0.10 | active | — | — |
| MongoDB 7.0.4 | active | — | — |
| MongoDB 5.0.24 | active | — | — |

## 解决方案

1. ```
   Use GridFS to store large documents. Split the document into chunks and store them in fs.files and fs.chunks collections. Example: `mongofiles put large_document.json`
   ```
2. ```
   Restructure the document to remove large arrays or subdocuments, storing them in separate collections with references.
   ```

## 无效尝试

- **** — MongoDB's 16MB limit is hardcoded and cannot be changed; no such startup parameter exists. (100% 失败率)
- **** — Compression must be done at the storage engine level (WiredTiger), not by the application; the BSON size check occurs before storage. (90% 失败率)
