- mongo-ops now serves /mongo-ops/wiki/ and /mongo-ops/lib/ independently - add mongo-ops MCP bundle under mcp/mongo-ops - fix copy-paste mcp server (jwtlib -> mongo_ops) in config.yml - .drone.yml/Dockerfile: publish port 8007 for mongo-ops MCP
285 lines
16 KiB
JSON
285 lines
16 KiB
JSON
{
|
|
"module": "mongo_ops.registry",
|
|
"content": {
|
|
"path": "mongo_ops.registry",
|
|
"docstring": "Model registration for multi-service initialization.",
|
|
"objects": {
|
|
"Dict": {
|
|
"name": "Dict",
|
|
"kind": "alias",
|
|
"path": "mongo_ops.registry.Dict",
|
|
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
|
|
"docstring": null
|
|
},
|
|
"List": {
|
|
"name": "List",
|
|
"kind": "alias",
|
|
"path": "mongo_ops.registry.List",
|
|
"signature": "<bound method Alias.signature of Alias('List', 'typing.List')>",
|
|
"docstring": null
|
|
},
|
|
"Optional": {
|
|
"name": "Optional",
|
|
"kind": "alias",
|
|
"path": "mongo_ops.registry.Optional",
|
|
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
|
|
"docstring": null
|
|
},
|
|
"Type": {
|
|
"name": "Type",
|
|
"kind": "alias",
|
|
"path": "mongo_ops.registry.Type",
|
|
"signature": "<bound method Alias.signature of Alias('Type', 'typing.Type')>",
|
|
"docstring": null
|
|
},
|
|
"AsyncIOMotorDatabase": {
|
|
"name": "AsyncIOMotorDatabase",
|
|
"kind": "alias",
|
|
"path": "mongo_ops.registry.AsyncIOMotorDatabase",
|
|
"signature": "<bound method Alias.signature of Alias('AsyncIOMotorDatabase', 'motor.motor_asyncio.AsyncIOMotorDatabase')>",
|
|
"docstring": null
|
|
},
|
|
"CacheBackend": {
|
|
"name": "CacheBackend",
|
|
"kind": "class",
|
|
"path": "mongo_ops.registry.CacheBackend",
|
|
"signature": "<bound method Alias.signature of Alias('CacheBackend', 'mongo_ops.cache.backend.CacheBackend')>",
|
|
"docstring": null,
|
|
"members": {
|
|
"get": {
|
|
"name": "get",
|
|
"kind": "function",
|
|
"path": "mongo_ops.registry.CacheBackend.get",
|
|
"signature": "<bound method Alias.signature of Alias('get', 'mongo_ops.cache.backend.CacheBackend.get')>",
|
|
"docstring": null
|
|
},
|
|
"set": {
|
|
"name": "set",
|
|
"kind": "function",
|
|
"path": "mongo_ops.registry.CacheBackend.set",
|
|
"signature": "<bound method Alias.signature of Alias('set', 'mongo_ops.cache.backend.CacheBackend.set')>",
|
|
"docstring": null
|
|
},
|
|
"delete": {
|
|
"name": "delete",
|
|
"kind": "function",
|
|
"path": "mongo_ops.registry.CacheBackend.delete",
|
|
"signature": "<bound method Alias.signature of Alias('delete', 'mongo_ops.cache.backend.CacheBackend.delete')>",
|
|
"docstring": null
|
|
},
|
|
"exists": {
|
|
"name": "exists",
|
|
"kind": "function",
|
|
"path": "mongo_ops.registry.CacheBackend.exists",
|
|
"signature": "<bound method Alias.signature of Alias('exists', 'mongo_ops.cache.backend.CacheBackend.exists')>",
|
|
"docstring": null
|
|
},
|
|
"clear_pattern": {
|
|
"name": "clear_pattern",
|
|
"kind": "function",
|
|
"path": "mongo_ops.registry.CacheBackend.clear_pattern",
|
|
"signature": "<bound method Alias.signature of Alias('clear_pattern', 'mongo_ops.cache.backend.CacheBackend.clear_pattern')>",
|
|
"docstring": null
|
|
},
|
|
"get_stats": {
|
|
"name": "get_stats",
|
|
"kind": "function",
|
|
"path": "mongo_ops.registry.CacheBackend.get_stats",
|
|
"signature": "<bound method Alias.signature of Alias('get_stats', 'mongo_ops.cache.backend.CacheBackend.get_stats')>",
|
|
"docstring": null
|
|
},
|
|
"initialize": {
|
|
"name": "initialize",
|
|
"kind": "function",
|
|
"path": "mongo_ops.registry.CacheBackend.initialize",
|
|
"signature": "<bound method Alias.signature of Alias('initialize', 'mongo_ops.cache.backend.CacheBackend.initialize')>",
|
|
"docstring": null
|
|
},
|
|
"shutdown": {
|
|
"name": "shutdown",
|
|
"kind": "function",
|
|
"path": "mongo_ops.registry.CacheBackend.shutdown",
|
|
"signature": "<bound method Alias.signature of Alias('shutdown', 'mongo_ops.cache.backend.CacheBackend.shutdown')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"MongoConnectionManager": {
|
|
"name": "MongoConnectionManager",
|
|
"kind": "class",
|
|
"path": "mongo_ops.registry.MongoConnectionManager",
|
|
"signature": "<bound method Alias.signature of Alias('MongoConnectionManager', 'mongo_ops.connection.MongoConnectionManager')>",
|
|
"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.registry.MongoConnectionManager.connect",
|
|
"signature": "<bound method Alias.signature of Alias('connect', 'mongo_ops.connection.MongoConnectionManager.connect')>",
|
|
"docstring": "Connect to MongoDB and initialize the shared client.\n\nArgs:\n uri: MongoDB connection URI (e.g., \"mongodb://localhost:27017\").\n db_name: 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.registry.MongoConnectionManager.disconnect",
|
|
"signature": "<bound method Alias.signature of Alias('disconnect', 'mongo_ops.connection.MongoConnectionManager.disconnect')>",
|
|
"docstring": "Close the active MongoDB connection and cleanup resources."
|
|
},
|
|
"get_database": {
|
|
"name": "get_database",
|
|
"kind": "function",
|
|
"path": "mongo_ops.registry.MongoConnectionManager.get_database",
|
|
"signature": "<bound method Alias.signature of Alias('get_database', 'mongo_ops.connection.MongoConnectionManager.get_database')>",
|
|
"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.registry.MongoConnectionManager.get_client",
|
|
"signature": "<bound method Alias.signature of Alias('get_client', 'mongo_ops.connection.MongoConnectionManager.get_client')>",
|
|
"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.registry.MongoConnectionManager.lifespan",
|
|
"signature": "<bound method Alias.signature of Alias('lifespan', 'mongo_ops.connection.MongoConnectionManager.lifespan')>",
|
|
"docstring": "Async context manager for managing connection lifecycle.\n\nDesigned for use with FastAPI or other frameworks supporting \nlifespan management.\n\nArgs:\n uri: MongoDB connection URI.\n db_name: Name of the database.\n **kwargs: Additional Motor client options.\n\nYields:\n AsyncIOMotorDatabase: The active database instance.\n\nUsage:\n @asynccontextmanager\n async def lifespan(app: FastAPI):\n async with MongoConnectionManager.lifespan(uri, db_name):\n yield"
|
|
}
|
|
}
|
|
},
|
|
"BaseDocument": {
|
|
"name": "BaseDocument",
|
|
"kind": "class",
|
|
"path": "mongo_ops.registry.BaseDocument",
|
|
"signature": "<bound method Alias.signature of Alias('BaseDocument', 'mongo_ops.models.BaseDocument')>",
|
|
"docstring": "Base document class with common MongoDB fields.\n\nInherit from this class to create Pydantic models that represent \nMongoDB documents. It includes automatic handling of the `_id` field \nand timestamps.\n\nAttributes:\n id: The MongoDB document ID (aliased to `_id`).\n created_at: Timestamp when the document was created.\n updated_at: Timestamp when the document was last updated.",
|
|
"members": {
|
|
"id": {
|
|
"name": "id",
|
|
"kind": "attribute",
|
|
"path": "mongo_ops.registry.BaseDocument.id",
|
|
"signature": "<bound method Alias.signature of Alias('id', 'mongo_ops.models.BaseDocument.id')>",
|
|
"docstring": null
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"kind": "attribute",
|
|
"path": "mongo_ops.registry.BaseDocument.created_at",
|
|
"signature": "<bound method Alias.signature of Alias('created_at', 'mongo_ops.models.BaseDocument.created_at')>",
|
|
"docstring": null
|
|
},
|
|
"updated_at": {
|
|
"name": "updated_at",
|
|
"kind": "attribute",
|
|
"path": "mongo_ops.registry.BaseDocument.updated_at",
|
|
"signature": "<bound method Alias.signature of Alias('updated_at', 'mongo_ops.models.BaseDocument.updated_at')>",
|
|
"docstring": null
|
|
},
|
|
"Config": {
|
|
"name": "Config",
|
|
"kind": "class",
|
|
"path": "mongo_ops.registry.BaseDocument.Config",
|
|
"signature": "<bound method Alias.signature of Alias('Config', 'mongo_ops.models.BaseDocument.Config')>",
|
|
"docstring": null,
|
|
"members": {
|
|
"populate_by_name": {
|
|
"name": "populate_by_name",
|
|
"kind": "attribute",
|
|
"path": "mongo_ops.registry.BaseDocument.Config.populate_by_name",
|
|
"signature": "<bound method Alias.signature of Alias('populate_by_name', 'mongo_ops.models.BaseDocument.Config.populate_by_name')>",
|
|
"docstring": null
|
|
},
|
|
"arbitrary_types_allowed": {
|
|
"name": "arbitrary_types_allowed",
|
|
"kind": "attribute",
|
|
"path": "mongo_ops.registry.BaseDocument.Config.arbitrary_types_allowed",
|
|
"signature": "<bound method Alias.signature of Alias('arbitrary_types_allowed', 'mongo_ops.models.BaseDocument.Config.arbitrary_types_allowed')>",
|
|
"docstring": null
|
|
},
|
|
"json_encoders": {
|
|
"name": "json_encoders",
|
|
"kind": "attribute",
|
|
"path": "mongo_ops.registry.BaseDocument.Config.json_encoders",
|
|
"signature": "<bound method Alias.signature of Alias('json_encoders', 'mongo_ops.models.BaseDocument.Config.json_encoders')>",
|
|
"docstring": null
|
|
},
|
|
"json_schema_extra": {
|
|
"name": "json_schema_extra",
|
|
"kind": "attribute",
|
|
"path": "mongo_ops.registry.BaseDocument.Config.json_schema_extra",
|
|
"signature": "<bound method Alias.signature of Alias('json_schema_extra', 'mongo_ops.models.BaseDocument.Config.json_schema_extra')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"ModelRegistry": {
|
|
"name": "ModelRegistry",
|
|
"kind": "class",
|
|
"path": "mongo_ops.registry.ModelRegistry",
|
|
"signature": "<bound method Class.signature of Class('ModelRegistry', 11, 149)>",
|
|
"docstring": "Registry for managing multiple models and their collections.\n\nThis registry allows central management of collections and their \nassociated indexes, making it easier to perform mass initialization \nat application startup.",
|
|
"members": {
|
|
"register": {
|
|
"name": "register",
|
|
"kind": "function",
|
|
"path": "mongo_ops.registry.ModelRegistry.register",
|
|
"signature": "<bound method Function.signature of Function('register', 24, 48)>",
|
|
"docstring": "Register a model with its collection and indexes.\n\nArgs:\n collection_name: Name of the MongoDB collection.\n model: Document model class (subclass of BaseDocument).\n indexes: List of index specifications (e.g., [(\"email\", 1)]).\n\nUsage:\n ModelRegistry.register(\n \"users\",\n UserDocument,\n indexes=[(\"email\", 1), (\"created_at\", -1)]\n )"
|
|
},
|
|
"initialize_all": {
|
|
"name": "initialize_all",
|
|
"kind": "function",
|
|
"path": "mongo_ops.registry.ModelRegistry.initialize_all",
|
|
"signature": "<bound method Function.signature of Function('initialize_all', 50, 67)>",
|
|
"docstring": "Initialize all registered collections and create indexes.\n\nThis method should be called during application startup to ensure \nall necessary indexes exist in the database.\n\nArgs:\n db: Database instance. If not provided, uses the global database \n from MongoConnectionManager."
|
|
},
|
|
"get_model": {
|
|
"name": "get_model",
|
|
"kind": "function",
|
|
"path": "mongo_ops.registry.ModelRegistry.get_model",
|
|
"signature": "<bound method Function.signature of Function('get_model', 69, 85)>",
|
|
"docstring": "Retrieve a registered model by its collection name.\n\nArgs:\n collection_name: The name of the collection.\n\nReturns:\n Type[BaseDocument]: The registered model class.\n\nRaises:\n KeyError: If the model for the given collection is not registered."
|
|
},
|
|
"list_collections": {
|
|
"name": "list_collections",
|
|
"kind": "function",
|
|
"path": "mongo_ops.registry.ModelRegistry.list_collections",
|
|
"signature": "<bound method Function.signature of Function('list_collections', 87, 95)>",
|
|
"docstring": "List all registered collection names.\n\nReturns:\n List[str]: A list of collection names."
|
|
},
|
|
"get_cache_backend": {
|
|
"name": "get_cache_backend",
|
|
"kind": "function",
|
|
"path": "mongo_ops.registry.ModelRegistry.get_cache_backend",
|
|
"signature": "<bound method Function.signature of Function('get_cache_backend', 97, 105)>",
|
|
"docstring": "Get the registered cache backend instance.\n\nReturns:\n Optional[CacheBackend]: The cache backend, if registered."
|
|
},
|
|
"set_cache_backend": {
|
|
"name": "set_cache_backend",
|
|
"kind": "function",
|
|
"path": "mongo_ops.registry.ModelRegistry.set_cache_backend",
|
|
"signature": "<bound method Function.signature of Function('set_cache_backend', 107, 119)>",
|
|
"docstring": "Register a cache backend for all cache-enabled repositories.\n\nShould be called after MongoDB connection is established,\nbefore cache-backed repositories are used.\n\nArgs:\n backend: A CacheBackend instance (InMemoryCacheBackend\n or RedisCacheBackend)."
|
|
},
|
|
"initialize_cache": {
|
|
"name": "initialize_cache",
|
|
"kind": "function",
|
|
"path": "mongo_ops.registry.ModelRegistry.initialize_cache",
|
|
"signature": "<bound method Function.signature of Function('initialize_cache', 121, 137)>",
|
|
"docstring": "Initialize the registered cache backend.\n\nMust be called after set_cache_backend() and before any\ncache-backed repository operations. Typically called right\nafter MongoDB connection is established.\n\nRaises:\n RuntimeError: If no cache backend has been registered."
|
|
},
|
|
"shutdown_cache": {
|
|
"name": "shutdown_cache",
|
|
"kind": "function",
|
|
"path": "mongo_ops.registry.ModelRegistry.shutdown_cache",
|
|
"signature": "<bound method Function.signature of Function('shutdown_cache', 139, 149)>",
|
|
"docstring": "Shutdown the registered cache backend gracefully.\n\nShould be called during application shutdown to clean up\nbackground tasks (e.g., in-memory TTL cleanup)."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |