{
  "id": "mongodb/index-key-too-large-for-compound-index",
  "signature": "MongoServerError: IndexKeyTooLarge: index key for compound index 'idx_1_2_3' on namespace test.events has key size 1050 bytes, which exceeds the maximum index key size of 1024 bytes",
  "signature_zh": "MongoServerError：IndexKeyTooLarge：命名空间 test.events 上复合索引 'idx_1_2_3' 的索引键大小为 1050 字节，超过了最大索引键大小 1024 字节",
  "regex": "MongoServerError: IndexKeyTooLarge: index key for compound index '.*' on namespace .* has key size \\d+ bytes, which exceeds the maximum index key size of 1024 bytes",
  "domain": "mongodb",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "The combined size of indexed fields in a document exceeds MongoDB's 1024-byte index key limit, often due to large string or array values.",
  "root_cause_type": "generic",
  "root_cause_zh": "文档中索引字段的组合大小超过了 MongoDB 的 1024 字节索引键限制，通常由于大字符串或数组值导致。",
  "versions": [
    {
      "version": "mongodb-5.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "mongodb-6.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "mongodb-7.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "mongodb-8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Increasing the index key limit is not possible; it is a hard limit in MongoDB.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Dropping the compound index and creating multiple single-field indexes may degrade query performance for multi-field queries.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Using a hashed index on all fields reduces query flexibility and does not support range queries.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Reduce the size of indexed fields by truncating long strings or using smaller data types (e.g., ObjectId instead of string IDs).",
      "success_rate": 0.85,
      "how": "Reduce the size of indexed fields by truncating long strings or using smaller data types (e.g., ObjectId instead of string IDs).",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a partial index that only indexes documents with smaller field values to avoid the limit.",
      "success_rate": 0.8,
      "how": "Use a partial index that only indexes documents with smaller field values to avoid the limit.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Split the compound index into separate indexes and use $or queries to combine them, though this may affect performance.",
      "success_rate": 0.7,
      "how": "Split the compound index into separate indexes and use $or queries to combine them, though this may affect performance.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Reduce the size of indexed fields by truncating long strings or using smaller data types (e.g., ObjectId instead of string IDs).",
    "Use a partial index that only indexes documents with smaller field values to avoid the limit.",
    "Split the compound index into separate indexes and use $or queries to combine them, though this may affect performance."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.mongodb.com/docs/manual/reference/limits/#Index-Key-Limit",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.89,
  "fix_success_rate": 0.78,
  "resolvable": "true",
  "first_seen": "2023-09-18",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}