{
  "id": "mongodb/query-exceeded-time-limit-for-secondary-read",
  "signature": "MongoServerError: QueryExceededTimeLimit: query on namespace test.orders exceeded time limit of 5000ms for secondary read",
  "signature_zh": "MongoServerError：QueryExceededTimeLimit：对命名空间 test.orders 的查询超过了从节点读取的 5000 毫秒时间限制",
  "regex": "MongoServerError: QueryExceededTimeLimit: query on namespace .* exceeded time limit of \\d+ms for secondary read",
  "domain": "mongodb",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A read operation on a secondary node took longer than the configured maxTimeMS due to high load or missing indexes.",
  "root_cause_type": "generic",
  "root_cause_zh": "由于高负载或缺少索引，从节点上的读取操作耗时超过配置的 maxTimeMS。",
  "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": "Setting readPreference to primary only increases load on the primary and does not fix the underlying query performance.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Increasing maxTimeMS globally can mask performance issues and lead to resource exhaustion.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Disabling secondary reads entirely reduces read throughput and defeats the purpose of replication.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Add an index that covers the query fields using db.collection.createIndex() to reduce scan time.",
      "success_rate": 0.9,
      "how": "Add an index that covers the query fields using db.collection.createIndex() to reduce scan time.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Increase maxTimeMS for specific queries using .maxTimeMS(10000) in the application code.",
      "success_rate": 0.8,
      "how": "Increase maxTimeMS for specific queries using .maxTimeMS(10000) in the application code.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a read preference tag to route queries to less loaded secondary nodes.",
      "success_rate": 0.75,
      "how": "Use a read preference tag to route queries to less loaded secondary nodes.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Add an index that covers the query fields using db.collection.createIndex() to reduce scan time.",
    "Increase maxTimeMS for specific queries using .maxTimeMS(10000) in the application code.",
    "Use a read preference tag to route queries to less loaded secondary nodes."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.mongodb.com/docs/manual/reference/method/cursor.maxTimeMS/",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.82,
  "resolvable": "true",
  "first_seen": "2025-03-22",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}