INFO:     Uvicorn running on http://0.0.0.0:8001 (Press CTRL+C to quit)
INFO:     Started parent process [553528]
INFO:     Started server process [553530]
INFO:     Waiting for application startup.
INFO:     Started server process [553531]
INFO:     Waiting for application startup.
INFO:     Started server process [553532]
INFO:     Waiting for application startup.
INFO:     Started server process [553533]
INFO:     Waiting for application startup.
2026-01-27 09:03:28,929 - root - WARNING - Failed to connect to MongoDB: localhost:27017: [Errno 111] Connection refused, Timeout: 2.0s, Topology Description: <TopologyDescription id: 69783206f2c97288c20dff41, topology_type: Unknown, servers: [<ServerDescription ('localhost', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('localhost:27017: [Errno 111] Connection refused')>]>. Falling back to MOCK database.
2026-01-27 09:03:28,940 - root - WARNING - Failed to connect to MongoDB: localhost:27017: [Errno 111] Connection refused, Timeout: 2.0s, Topology Description: <TopologyDescription id: 697832068ef8448ea7a7511a, topology_type: Unknown, servers: [<ServerDescription ('localhost', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('localhost:27017: [Errno 111] Connection refused')>]>. Falling back to MOCK database.
2026-01-27 09:03:28,952 - root - INFO - Connected to MongoDB
2026-01-27 09:03:28,956 - root - INFO - Connected to MongoDB
2026-01-27 09:03:28,956 - passlib.handlers.bcrypt - WARNING - (trapped) error reading bcrypt version
Traceback (most recent call last):
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/passlib/handlers/bcrypt.py", line 620, in _load_backend_mixin
    version = _bcrypt.__about__.__version__
              ^^^^^^^^^^^^^^^^^
AttributeError: module 'bcrypt' has no attribute '__about__'
2026-01-27 09:03:28,959 - passlib.handlers.bcrypt - WARNING - (trapped) error reading bcrypt version
Traceback (most recent call last):
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/passlib/handlers/bcrypt.py", line 620, in _load_backend_mixin
    version = _bcrypt.__about__.__version__
              ^^^^^^^^^^^^^^^^^
AttributeError: module 'bcrypt' has no attribute '__about__'
2026-01-27 09:03:28,960 - root - WARNING - Failed to connect to MongoDB: localhost:27017: [Errno 111] Connection refused, Timeout: 2.0s, Topology Description: <TopologyDescription id: 697832063501555ed69ef496, topology_type: Unknown, servers: [<ServerDescription ('localhost', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('localhost:27017: [Errno 111] Connection refused')>]>. Falling back to MOCK database.
2026-01-27 09:03:28,960 - root - WARNING - Failed to connect to MongoDB: localhost:27017: [Errno 111] Connection refused, Timeout: 2.0s, Topology Description: <TopologyDescription id: 69783206ff15e6468bcc4669, topology_type: Unknown, servers: [<ServerDescription ('localhost', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('localhost:27017: [Errno 111] Connection refused')>]>. Falling back to MOCK database.
2026-01-27 09:03:28,976 - root - INFO - Connected to MongoDB
2026-01-27 09:03:28,978 - root - INFO - Connected to MongoDB
2026-01-27 09:03:28,980 - passlib.handlers.bcrypt - WARNING - (trapped) error reading bcrypt version
Traceback (most recent call last):
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/passlib/handlers/bcrypt.py", line 620, in _load_backend_mixin
    version = _bcrypt.__about__.__version__
              ^^^^^^^^^^^^^^^^^
AttributeError: module 'bcrypt' has no attribute '__about__'
2026-01-27 09:03:28,982 - passlib.handlers.bcrypt - WARNING - (trapped) error reading bcrypt version
Traceback (most recent call last):
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/passlib/handlers/bcrypt.py", line 620, in _load_backend_mixin
    version = _bcrypt.__about__.__version__
              ^^^^^^^^^^^^^^^^^
AttributeError: module 'bcrypt' has no attribute '__about__'
2026-01-27 09:03:29,208 - root - INFO - Demo user created on startup
INFO:     Application startup complete.
2026-01-27 09:03:29,213 - root - INFO - Demo user created on startup
INFO:     Application startup complete.
2026-01-27 09:03:29,232 - root - INFO - Demo user created on startup
INFO:     Application startup complete.
2026-01-27 09:03:29,236 - root - INFO - Demo user created on startup
INFO:     Application startup complete.
INFO:     127.0.0.1:42666 - "GET /api/auth/me HTTP/1.1" 401 Unauthorized
INFO:     127.0.0.1:42682 - "GET /api/auth/me HTTP/1.1" 401 Unauthorized
INFO:     127.0.0.1:52900 - "OPTIONS /api/auth/login HTTP/1.1" 200 OK
INFO:     127.0.0.1:52908 - "POST /api/auth/login HTTP/1.1" 200 OK
INFO:     127.0.0.1:52908 - "GET /api/dashboard/stats HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 408, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/starlette/applications.py", line 123, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in __call__
    raise exc
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/starlette/middleware/cors.py", line 93, in __call__
    await self.simple_response(scope, receive, send, request_headers=headers)
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/starlette/middleware/cors.py", line 148, in simple_response
    await self.app(scope, receive, send)
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/starlette/routing.py", line 756, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/starlette/routing.py", line 776, in app
    await route.handle(scope, receive, send)
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/starlette/routing.py", line 297, in handle
    await self.app(scope, receive, send)
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/starlette/routing.py", line 77, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/starlette/routing.py", line 72, in app
    response = await func(request)
               ^^^^^^^^^^^^^^^^^^^
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 278, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lcs/Documents/dev/EduA03-main/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
    return await dependant.call(**values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lcs/Documents/dev/EduA03-main/backend/app/api/v1/endpoints/dashboard.py", line 22, in get_dashboard_stats
    ).sort("completed_at", -1).limit(5).to_list(length=5)
                                        ^^^^^^^
AttributeError: 'Cursor' object has no attribute 'to_list'
INFO:     127.0.0.1:52900 - "GET /api/dashboard/stats HTTP/1.1" 401 Unauthorized
INFO:     127.0.0.1:52900 - "GET /api/courses HTTP/1.1" 200 OK
INFO:     127.0.0.1:52900 - "GET /api/courses HTTP/1.1" 200 OK
INFO:     127.0.0.1:52922 - "GET /api/courses/my-enrollments HTTP/1.1" 401 Unauthorized
INFO:     127.0.0.1:52924 - "GET /api/courses/my-enrollments HTTP/1.1" 401 Unauthorized
INFO:     127.0.0.1:52930 - "POST /api/courses/payment HTTP/1.1" 200 OK
INFO:     127.0.0.1:52930 - "POST /api/courses/foundation-cybersecurity/enroll HTTP/1.1" 200 OK
INFO:     127.0.0.1:52930 - "GET /api/courses/my-enrollments HTTP/1.1" 200 OK
INFO:     127.0.0.1:52930 - "GET /api/courses HTTP/1.1" 200 OK
INFO:     127.0.0.1:52930 - "GET /api/courses HTTP/1.1" 200 OK
