{
  "id": "mongodb/transaction-api-version-error",
  "signature": "MongoServerError: Transaction API version error: expected API version '1' but received '2'",
  "signature_zh": "MongoServerError: 事务 API 版本错误：预期 API 版本 '1' 但收到 '2'",
  "regex": "Transaction API version error: expected API version '\\d+' but received '\\d+'",
  "domain": "mongodb",
  "category": "protocol_error",
  "subcategory": null,
  "root_cause": "A driver or application attempted to use an unsupported transaction API version, typically due to driver/library version mismatch with the MongoDB server.",
  "root_cause_type": "generic",
  "root_cause_zh": "驱动程序或应用程序尝试使用不受支持的事务 API 版本，通常是由于驱动程序/库版本与 MongoDB 服务器不匹配。",
  "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"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Upgrading the MongoDB server to the latest version doesn't fix the mismatch if the driver is outdated.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Setting transaction options to empty object in the driver is ignored because the API version is negotiated at connection time.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Upgrade the MongoDB driver to a version compatible with the server API version. For Node.js: npm install mongodb@6.3.0. For Python: pip install pymongo==4.6.0.",
      "success_rate": 0.95,
      "how": "Upgrade the MongoDB driver to a version compatible with the server API version. For Node.js: npm install mongodb@6.3.0. For Python: pip install pymongo==4.6.0.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Set the API version explicitly in the connection string: mongodb://localhost:27017/?apiVersion=1 to force compatibility.",
      "success_rate": 0.85,
      "how": "Set the API version explicitly in the connection string: mongodb://localhost:27017/?apiVersion=1 to force compatibility.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "升级 MongoDB 驱动程序到与服务器 API 版本兼容的版本。对于 Node.js：npm install mongodb@6.3.0。对于 Python：pip install pymongo==4.6.0。",
    "在连接字符串中显式设置 API 版本：mongodb://localhost:27017/?apiVersion=1 以强制兼容性。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.mongodb.com/docs/manual/reference/command/commitTransaction/",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2024-06-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}