[{'Text': '\ndef find_operators(country: str = "") -> list[dict[str, Any]]:\n    """List operators. country="" for all."""\n    query = f\'{{country: {_js_str(country)}}}\' if country else "{}"\n    # Use EJSON.stringify for proper ObjectId handling\n    js = f"EJSON.stringify(db.{OPERATOR_COLLECTION}.find({query}).toArray())"\n    out = _run_mongosh(js)\n    data = json.loads(out) if out else []\n    return data if isinstance(data, list) else [data]\n\n\ndef find_one_operator(name: str, country: str) -> dict | None:\n    """Find operator by name and country."""\n    query = f\'{{name: {_js_str(name)}, country: {_js_str(country)}}}\'\n    js = f"EJSON.stringify(db.{OPERATOR_COLLECTION}.findOne({query}))"\n    out = _run_mongosh(js)\n    data = json.loads(out) if out else None\n    return data if data and data.get("_id") else None\n\n\ndef find_one_operator_by_id(oid_str: str) -> dict | None:\n    """Find operator by ObjectId string."""\n    # mongosh: ObjectId("hex")\n    query = f\'ObjectId("{oid_str}")\'\n    js = f"EJSON.stringify(db.{OPERATOR_COLLECTION}.findOne({{_id: {query}}}))"\n    out = _run_mongosh(js)\n    data = json.loads(out) if out else None\n    return data if data and data.get("_id") else None\n\n\ndef find_statistics(operator_id_oid: str, period: str) -> list[dict]:\n    """Find statistics for operator and period."""\n    period_js = _js_str(period)\n    js = f"""EJSON.stringify(\n      db.{STATISTICS_COLLECTION}.find({{\n        operatorId: ObjectId("{operator_id_oid}"),\n        period: {period_js}\n      }}).toArray()\n    )"""\n    out = _run_mongosh(js)\n    data = json.loads(out) if out else []\n    return data if isinstance(data, list) else [data]\n\n\ndef find_global_variables_current() -> dict | None:\n    """Get current GlobalVariables record."""\n    js = f"EJSON.stringify(db.{GLOBAL_VARIABLES_COLLECTION}.findOne({{isCurrent: true}}))"\n    out = _run_mongosh(js)\n    data = json.loads(out) if out else None\n    return data if data else None\n\n\ndef insert_one_statistic(doc: dict) -> str:\n    """Insert one Statistics document. Returns inserted ObjectId string."""\n    oid = doc["operatorId"]  # ObjectId string\n    op = doc["operator"].replace("\\\\", "\\\\\\\\").replace(\'"\', \'\\\\"\')\n'}]