P0: fix doc:// -> docs:// across standards src/server/registry and regenerate stale mongo-ops bundle. P1: build recipe + spec-first routing now document the openapi-first codegen fast path (models/routes with --inject-request/--package). P4: CRUD template documents the model-vs-document id rule (BaseDocument owns id). P5: authless guidance (omit security keys). P6: template gains generic infra (http_cache, keyed SSE bus, KV port+in-memory+Redis), interfaces/openapi.py + .dockerignore + generic build test registered as components, and a get_app_template tool; genericity matrix marks LLM pool + human-in-loop as reference-app patterns. P7: intake/build/start_app/trial prompts. P8: template ships tests/integration/test_openapi_app_builds.py. Rebuilt standards + openapi-first bundles and re-collected.
53 lines
3.2 KiB
JSON
53 lines
3.2 KiB
JSON
{
|
|
"module": "mongo_ops.connection",
|
|
"content": {
|
|
"path": "mongo_ops.connection",
|
|
"docstring": "# Summary\n\nMongoDB connection management.",
|
|
"objects": {
|
|
"MongoConnectionManager": {
|
|
"name": "MongoConnectionManager",
|
|
"kind": "class",
|
|
"path": "mongo_ops.connection.MongoConnectionManager",
|
|
"signature": null,
|
|
"docstring": "Manages MongoDB connections with async lifecycle.\n\nThis class provides a singleton-like manager for the MongoDB client and\ndatabase instances, ensuring they are properly initialized and closed\nacross the application lifecycle.",
|
|
"members": {
|
|
"connect": {
|
|
"name": "connect",
|
|
"kind": "function",
|
|
"path": "mongo_ops.connection.MongoConnectionManager.connect",
|
|
"signature": "connect(uri: str, db_name: str, **kwargs: Any) -> AsyncIOMotorDatabase",
|
|
"docstring": "Connect to MongoDB and initialize the shared client.\n\nArgs:\n uri (str): MongoDB connection URI (e.g., \"mongodb://localhost:27017\").\n db_name (str): Name of the database to use.\n **kwargs: Additional Motor client options (e.g., maxPoolSize).\n\nReturns:\n AsyncIOMotorDatabase: The initialized database instance."
|
|
},
|
|
"disconnect": {
|
|
"name": "disconnect",
|
|
"kind": "function",
|
|
"path": "mongo_ops.connection.MongoConnectionManager.disconnect",
|
|
"signature": "disconnect() -> None",
|
|
"docstring": "Close the active MongoDB connection and cleanup resources."
|
|
},
|
|
"get_database": {
|
|
"name": "get_database",
|
|
"kind": "function",
|
|
"path": "mongo_ops.connection.MongoConnectionManager.get_database",
|
|
"signature": "get_database() -> AsyncIOMotorDatabase",
|
|
"docstring": "Retrieve the current database instance.\n\nReturns:\n AsyncIOMotorDatabase: The active database instance.\n\nRaises:\n RuntimeError: If connect() has not been called yet."
|
|
},
|
|
"get_client": {
|
|
"name": "get_client",
|
|
"kind": "function",
|
|
"path": "mongo_ops.connection.MongoConnectionManager.get_client",
|
|
"signature": "get_client() -> AsyncIOMotorClient",
|
|
"docstring": "Retrieve the current client instance.\n\nReturns:\n AsyncIOMotorClient: The active Motor client instance.\n\nRaises:\n RuntimeError: If connect() has not been called yet."
|
|
},
|
|
"lifespan": {
|
|
"name": "lifespan",
|
|
"kind": "function",
|
|
"path": "mongo_ops.connection.MongoConnectionManager.lifespan",
|
|
"signature": "lifespan(uri: str, db_name: str, **kwargs: Any) -> AbstractAsyncContextManager[AsyncIOMotorDatabase]",
|
|
"docstring": "Async context manager for managing connection lifecycle.\n\nDesigned for use with FastAPI or other frameworks supporting\nlifespan management.\n\nNotes:\n Connects to MongoDB on entry, yields the active database instance\n to the context body, and disconnects on exit.\n\nUsage:\n @asynccontextmanager\n async def lifespan(app: FastAPI):\n async with MongoConnectionManager.lifespan(uri, db_name):\n yield"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |