{ "module": "mongo_ops", "content": { "path": "mongo_ops", "docstring": "mongo-ops: A modular MongoDB operations layer for FastAPI microservices.\n\nThis package provide a standardized way to interact with MongoDB in async \nPython applications, particularly optimized for FastAPI. It includes:\n\n- **Connection Management**: Async lifecycle management for Motor clients.\n- **Base Models**: Pydantic v2 models for MongoDB documents.\n- **Repository Pattern**: Generic CRUD operations and base repository classes.\n- **Caching**: In-memory and Redis cache backends with ID-based caching.\n- **Population**: Recursive document populating with cycle detection.\n- **Transactions**: Helpers for multi-document ACID transactions.\n- **Registry**: Centralized model, index, and cache lifecycle management.\n\nExample:\n ```python\n from mongo_ops import BaseDocument, BaseRepository, CachedBaseRepository\n from mongo_ops.cache import InMemoryCacheBackend, CacheConfig\n\n class User(BaseDocument):\n username: str\n\n class UserRepository(BaseRepository[User]):\n def __init__(self):\n super().__init__(\"users\", User)\n\n # With caching:\n cache = InMemoryCacheBackend()\n class CachedUserRepo(CachedBaseRepository[User]):\n def __init__(self):\n super().__init__(\"users\", User, cache)\n ```", "objects": { "CachedBaseRepository": { "name": "CachedBaseRepository", "kind": "class", "path": "mongo_ops.CachedBaseRepository", "signature": "", "docstring": null, "members": { "get_by_id": { "name": "get_by_id", "kind": "function", "path": "mongo_ops.CachedBaseRepository.get_by_id", "signature": "", "docstring": null }, "create": { "name": "create", "kind": "function", "path": "mongo_ops.CachedBaseRepository.create", "signature": "", "docstring": null }, "update": { "name": "update", "kind": "function", "path": "mongo_ops.CachedBaseRepository.update", "signature": "", "docstring": null }, "delete": { "name": "delete", "kind": "function", "path": "mongo_ops.CachedBaseRepository.delete", "signature": "", "docstring": null }, "warm_cache": { "name": "warm_cache", "kind": "function", "path": "mongo_ops.CachedBaseRepository.warm_cache", "signature": "", "docstring": null }, "invalidate_cache": { "name": "invalidate_cache", "kind": "function", "path": "mongo_ops.CachedBaseRepository.invalidate_cache", "signature": "", "docstring": null } } }, "MongoConnectionManager": { "name": "MongoConnectionManager", "kind": "class", "path": "mongo_ops.MongoConnectionManager", "signature": "", "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.MongoConnectionManager.connect", "signature": "", "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.MongoConnectionManager.disconnect", "signature": "", "docstring": "Close the active MongoDB connection and cleanup resources." }, "get_database": { "name": "get_database", "kind": "function", "path": "mongo_ops.MongoConnectionManager.get_database", "signature": "", "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.MongoConnectionManager.get_client", "signature": "", "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.MongoConnectionManager.lifespan", "signature": "", "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.BaseDocument", "signature": "", "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.BaseDocument.id", "signature": "", "docstring": null }, "created_at": { "name": "created_at", "kind": "attribute", "path": "mongo_ops.BaseDocument.created_at", "signature": "", "docstring": null }, "updated_at": { "name": "updated_at", "kind": "attribute", "path": "mongo_ops.BaseDocument.updated_at", "signature": "", "docstring": null }, "Config": { "name": "Config", "kind": "class", "path": "mongo_ops.BaseDocument.Config", "signature": "", "docstring": null, "members": { "populate_by_name": { "name": "populate_by_name", "kind": "attribute", "path": "mongo_ops.BaseDocument.Config.populate_by_name", "signature": "", "docstring": null }, "arbitrary_types_allowed": { "name": "arbitrary_types_allowed", "kind": "attribute", "path": "mongo_ops.BaseDocument.Config.arbitrary_types_allowed", "signature": "", "docstring": null }, "json_encoders": { "name": "json_encoders", "kind": "attribute", "path": "mongo_ops.BaseDocument.Config.json_encoders", "signature": "", "docstring": null }, "json_schema_extra": { "name": "json_schema_extra", "kind": "attribute", "path": "mongo_ops.BaseDocument.Config.json_schema_extra", "signature": "", "docstring": null } } } } }, "ModelRegistry": { "name": "ModelRegistry", "kind": "class", "path": "mongo_ops.ModelRegistry", "signature": "", "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.ModelRegistry.register", "signature": "", "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.ModelRegistry.initialize_all", "signature": "", "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.ModelRegistry.get_model", "signature": "", "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.ModelRegistry.list_collections", "signature": "", "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.ModelRegistry.get_cache_backend", "signature": "", "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.ModelRegistry.set_cache_backend", "signature": "", "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.ModelRegistry.initialize_cache", "signature": "", "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.ModelRegistry.shutdown_cache", "signature": "", "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)." } } }, "BaseRepository": { "name": "BaseRepository", "kind": "class", "path": "mongo_ops.BaseRepository", "signature": "", "docstring": "Base repository class combining CRUD operations and collection management.\n\nThis class simplifies repository creation by automatically obtaining the \ndatabase connection and collection instance.\n\nAttributes:\n collection_name: The name of the collection managed by this repository.", "members": { "collection_name": { "name": "collection_name", "kind": "attribute", "path": "mongo_ops.BaseRepository.collection_name", "signature": "", "docstring": null } } }, "CRUDMixin": { "name": "CRUDMixin", "kind": "class", "path": "mongo_ops.CRUDMixin", "signature": "", "docstring": "Generic CRUD operations mixin for MongoDB collections.\n\nThis mixin provides standard Create, Read, Update, and Delete operations \nthat work with Pydantic models.\n\nAttributes:\n collection: The Motor collection instance.\n model: The Pydantic model class representing the document.", "members": { "collection": { "name": "collection", "kind": "attribute", "path": "mongo_ops.CRUDMixin.collection", "signature": "", "docstring": null }, "model": { "name": "model", "kind": "attribute", "path": "mongo_ops.CRUDMixin.model", "signature": "", "docstring": null }, "data_to_model": { "name": "data_to_model", "kind": "function", "path": "mongo_ops.CRUDMixin.data_to_model", "signature": "", "docstring": null }, "create": { "name": "create", "kind": "function", "path": "mongo_ops.CRUDMixin.create", "signature": "", "docstring": "Create a new document in the collection.\n\nArgs:\n data: The Pydantic model instance to insert.\n\nReturns:\n T: The created Pydantic model instance, including the assigned ID." }, "get_by_id": { "name": "get_by_id", "kind": "function", "path": "mongo_ops.CRUDMixin.get_by_id", "signature": "", "docstring": "Retrieve a document by its ID.\n\nArgs:\n id: The document ID (string or ObjectId).\n\nReturns:\n Optional[T]: The Pydantic model instance if found, else None." }, "get_many": { "name": "get_many", "kind": "function", "path": "mongo_ops.CRUDMixin.get_many", "signature": "", "docstring": "Retrieve multiple documents with filtering, pagination, and sorting.\n\nArgs:\n filter: MongoDB filter dictionary (e.g., {\"is_active\": True}).\n skip: Number of documents to skip for pagination.\n limit: Maximum number of documents to return (default 100).\n sort: List of sort specifications [(field, direction), ...].\n E.g., [(\"created_at\", -1)] for descending.\n\nReturns:\n List[T]: A list of Pydantic model instances.\n\nUsage:\n ```python\n users = await repo.get_many(\n filter={\"role\": \"admin\"},\n limit=10,\n sort=[(\"username\", 1)]\n )\n ```" }, "update": { "name": "update", "kind": "function", "path": "mongo_ops.CRUDMixin.update", "signature": "", "docstring": "Update a document by its ID using the $set operator.\n\nArgs:\n id: The document ID (string or ObjectId).\n data: A dictionary of fields and values to update.\n\nReturns:\n Optional[T]: The updated Pydantic model instance if found, else None.\n\nUsage:\n ```python\n updated_user = await repo.update(user_id, {\"email\": \"new@example.com\"})\n ```" }, "patch": { "name": "patch", "kind": "function", "path": "mongo_ops.CRUDMixin.patch", "signature": "", "docstring": "Partially update a document using $set (REST PATCH semantics).\n\nUnlike update(), patch() takes a partial dict and applies only those\nfields. PopulatingRepository overrides this to prevent patching FK fields.\n\nArgs:\n id: The document ID (string or ObjectId).\n data: A partial dictionary of fields and values to update.\n\nReturns:\n Optional[T]: The updated Pydantic model instance if found, else None." }, "delete": { "name": "delete", "kind": "function", "path": "mongo_ops.CRUDMixin.delete", "signature": "", "docstring": "Delete a document by its ID.\n\nArgs:\n id: The document ID (string or ObjectId).\n\nReturns:\n bool: True if a document was deleted, False otherwise." }, "count": { "name": "count", "kind": "function", "path": "mongo_ops.CRUDMixin.count", "signature": "", "docstring": "Count documents matching a filter.\n\nArgs:\n filter: MongoDB filter dictionary.\n\nReturns:\n int: The number of matching documents." } } }, "PopulatingRepository": { "name": "PopulatingRepository", "kind": "class", "path": "mongo_ops.PopulatingRepository", "signature": "", "docstring": null, "members": { "population_engine": { "name": "population_engine", "kind": "attribute", "path": "mongo_ops.PopulatingRepository.population_engine", "signature": "", "docstring": null }, "set_population_engine": { "name": "set_population_engine", "kind": "function", "path": "mongo_ops.PopulatingRepository.set_population_engine", "signature": "", "docstring": null }, "set_populate_rules": { "name": "set_populate_rules", "kind": "function", "path": "mongo_ops.PopulatingRepository.set_populate_rules", "signature": "", "docstring": null }, "data_to_model": { "name": "data_to_model", "kind": "function", "path": "mongo_ops.PopulatingRepository.data_to_model", "signature": "", "docstring": null }, "create": { "name": "create", "kind": "function", "path": "mongo_ops.PopulatingRepository.create", "signature": "", "docstring": null }, "update": { "name": "update", "kind": "function", "path": "mongo_ops.PopulatingRepository.update", "signature": "", "docstring": null }, "patch": { "name": "patch", "kind": "function", "path": "mongo_ops.PopulatingRepository.patch", "signature": "", "docstring": null } } }, "TransactionManager": { "name": "TransactionManager", "kind": "class", "path": "mongo_ops.TransactionManager", "signature": "", "docstring": "Simplified multi-document transaction handling.\n\nThis class provides helpers for executing operations within a MongoDB \ntransaction, ensuring ACID compliance for multi-document updates.", "members": { "start_session": { "name": "start_session", "kind": "function", "path": "mongo_ops.TransactionManager.start_session", "signature": "", "docstring": "Start a transaction session as an async context manager.\n\nArgs:\n **kwargs: Transaction options (e.g., read_concern, write_concern).\n\nYields:\n AsyncIOMotorClientSession: The active session with a started transaction.\n\nUsage:\n async with TransactionManager.start_session() as session:\n await collection.insert_one(doc, session=session)\n await other_collection.update_one(filter, update, session=session)" }, "execute_transaction": { "name": "execute_transaction", "kind": "function", "path": "mongo_ops.TransactionManager.execute_transaction", "signature": "", "docstring": "Execute multiple operations within a single transaction.\n\nArgs:\n operations: A list of async callables that accept a session \n parameter and return a result.\n **kwargs: Transaction options.\n\nReturns:\n List[Any]: A list containing the results of each operation.\n\nUsage:\n results = await TransactionManager.execute_transaction([\n lambda s: repo1.create(data1, session=s),\n lambda s: repo2.update(id, data2, session=s),\n ])" } } }, "connection": { "name": "connection", "kind": "module", "path": "mongo_ops.connection", "signature": null, "docstring": "MongoDB connection management.", "members": { "asynccontextmanager": { "name": "asynccontextmanager", "kind": "alias", "path": "mongo_ops.connection.asynccontextmanager", "signature": "", "docstring": null }, "Optional": { "name": "Optional", "kind": "alias", "path": "mongo_ops.connection.Optional", "signature": "", "docstring": null }, "AsyncIOMotorClient": { "name": "AsyncIOMotorClient", "kind": "alias", "path": "mongo_ops.connection.AsyncIOMotorClient", "signature": "", "docstring": null }, "AsyncIOMotorDatabase": { "name": "AsyncIOMotorDatabase", "kind": "alias", "path": "mongo_ops.connection.AsyncIOMotorDatabase", "signature": "", "docstring": null }, "MongoConnectionManager": { "name": "MongoConnectionManager", "kind": "class", "path": "mongo_ops.connection.MongoConnectionManager", "signature": "", "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": "", "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.connection.MongoConnectionManager.disconnect", "signature": "", "docstring": "Close the active MongoDB connection and cleanup resources." }, "get_database": { "name": "get_database", "kind": "function", "path": "mongo_ops.connection.MongoConnectionManager.get_database", "signature": "", "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": "", "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": "", "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" } } } } }, "models": { "name": "models", "kind": "module", "path": "mongo_ops.models", "signature": null, "docstring": "Base document models for MongoDB.", "members": { "datetime": { "name": "datetime", "kind": "alias", "path": "mongo_ops.models.datetime", "signature": "", "docstring": null }, "Any": { "name": "Any", "kind": "alias", "path": "mongo_ops.models.Any", "signature": "", "docstring": null }, "Optional": { "name": "Optional", "kind": "alias", "path": "mongo_ops.models.Optional", "signature": "", "docstring": null }, "ObjectId": { "name": "ObjectId", "kind": "alias", "path": "mongo_ops.models.ObjectId", "signature": "", "docstring": null }, "BaseModel": { "name": "BaseModel", "kind": "alias", "path": "mongo_ops.models.BaseModel", "signature": "", "docstring": null }, "Field": { "name": "Field", "kind": "alias", "path": "mongo_ops.models.Field", "signature": "", "docstring": null }, "GetCoreSchemaHandler": { "name": "GetCoreSchemaHandler", "kind": "alias", "path": "mongo_ops.models.GetCoreSchemaHandler", "signature": "", "docstring": null }, "core_schema": { "name": "core_schema", "kind": "alias", "path": "mongo_ops.models.core_schema", "signature": "", "docstring": null }, "PyObjectId": { "name": "PyObjectId", "kind": "class", "path": "mongo_ops.models.PyObjectId", "signature": "", "docstring": "Custom ObjectId type compatible with Pydantic v2.\n\nThis class extends the standard BSON ObjectId to provide validation and \nserialization support within Pydantic models.", "members": { "validate": { "name": "validate", "kind": "function", "path": "mongo_ops.models.PyObjectId.validate", "signature": "", "docstring": "Validate the input value and convert it to an ObjectId if possible.\n\nArgs:\n v: The value to validate (can be str or ObjectId).\n\nReturns:\n ObjectId: The validated ObjectId instance.\n\nRaises:\n ValueError: If the value is not a valid ObjectId." } } }, "BaseDocument": { "name": "BaseDocument", "kind": "class", "path": "mongo_ops.models.BaseDocument", "signature": "", "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.models.BaseDocument.id", "signature": null, "docstring": null }, "created_at": { "name": "created_at", "kind": "attribute", "path": "mongo_ops.models.BaseDocument.created_at", "signature": null, "docstring": null }, "updated_at": { "name": "updated_at", "kind": "attribute", "path": "mongo_ops.models.BaseDocument.updated_at", "signature": null, "docstring": null }, "Config": { "name": "Config", "kind": "class", "path": "mongo_ops.models.BaseDocument.Config", "signature": "", "docstring": null, "members": { "populate_by_name": { "name": "populate_by_name", "kind": "attribute", "path": "mongo_ops.models.BaseDocument.Config.populate_by_name", "signature": null, "docstring": null }, "arbitrary_types_allowed": { "name": "arbitrary_types_allowed", "kind": "attribute", "path": "mongo_ops.models.BaseDocument.Config.arbitrary_types_allowed", "signature": null, "docstring": null }, "json_encoders": { "name": "json_encoders", "kind": "attribute", "path": "mongo_ops.models.BaseDocument.Config.json_encoders", "signature": null, "docstring": null }, "json_schema_extra": { "name": "json_schema_extra", "kind": "attribute", "path": "mongo_ops.models.BaseDocument.Config.json_schema_extra", "signature": null, "docstring": null } } } } } } }, "registry": { "name": "registry", "kind": "module", "path": "mongo_ops.registry", "signature": null, "docstring": "Model registration for multi-service initialization.", "members": { "Dict": { "name": "Dict", "kind": "alias", "path": "mongo_ops.registry.Dict", "signature": "", "docstring": null }, "List": { "name": "List", "kind": "alias", "path": "mongo_ops.registry.List", "signature": "", "docstring": null }, "Optional": { "name": "Optional", "kind": "alias", "path": "mongo_ops.registry.Optional", "signature": "", "docstring": null }, "Type": { "name": "Type", "kind": "alias", "path": "mongo_ops.registry.Type", "signature": "", "docstring": null }, "AsyncIOMotorDatabase": { "name": "AsyncIOMotorDatabase", "kind": "alias", "path": "mongo_ops.registry.AsyncIOMotorDatabase", "signature": "", "docstring": null }, "CacheBackend": { "name": "CacheBackend", "kind": "class", "path": "mongo_ops.registry.CacheBackend", "signature": "", "docstring": null, "members": { "get": { "name": "get", "kind": "function", "path": "mongo_ops.registry.CacheBackend.get", "signature": "", "docstring": null }, "set": { "name": "set", "kind": "function", "path": "mongo_ops.registry.CacheBackend.set", "signature": "", "docstring": null }, "delete": { "name": "delete", "kind": "function", "path": "mongo_ops.registry.CacheBackend.delete", "signature": "", "docstring": null }, "exists": { "name": "exists", "kind": "function", "path": "mongo_ops.registry.CacheBackend.exists", "signature": "", "docstring": null }, "clear_pattern": { "name": "clear_pattern", "kind": "function", "path": "mongo_ops.registry.CacheBackend.clear_pattern", "signature": "", "docstring": null }, "get_stats": { "name": "get_stats", "kind": "function", "path": "mongo_ops.registry.CacheBackend.get_stats", "signature": "", "docstring": null }, "initialize": { "name": "initialize", "kind": "function", "path": "mongo_ops.registry.CacheBackend.initialize", "signature": "", "docstring": null }, "shutdown": { "name": "shutdown", "kind": "function", "path": "mongo_ops.registry.CacheBackend.shutdown", "signature": "", "docstring": null } } }, "MongoConnectionManager": { "name": "MongoConnectionManager", "kind": "class", "path": "mongo_ops.registry.MongoConnectionManager", "signature": "", "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": "", "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": "", "docstring": "Close the active MongoDB connection and cleanup resources." }, "get_database": { "name": "get_database", "kind": "function", "path": "mongo_ops.registry.MongoConnectionManager.get_database", "signature": "", "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": "", "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": "", "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": "", "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": "", "docstring": null }, "created_at": { "name": "created_at", "kind": "attribute", "path": "mongo_ops.registry.BaseDocument.created_at", "signature": "", "docstring": null }, "updated_at": { "name": "updated_at", "kind": "attribute", "path": "mongo_ops.registry.BaseDocument.updated_at", "signature": "", "docstring": null }, "Config": { "name": "Config", "kind": "class", "path": "mongo_ops.registry.BaseDocument.Config", "signature": "", "docstring": null, "members": { "populate_by_name": { "name": "populate_by_name", "kind": "attribute", "path": "mongo_ops.registry.BaseDocument.Config.populate_by_name", "signature": "", "docstring": null }, "arbitrary_types_allowed": { "name": "arbitrary_types_allowed", "kind": "attribute", "path": "mongo_ops.registry.BaseDocument.Config.arbitrary_types_allowed", "signature": "", "docstring": null }, "json_encoders": { "name": "json_encoders", "kind": "attribute", "path": "mongo_ops.registry.BaseDocument.Config.json_encoders", "signature": "", "docstring": null }, "json_schema_extra": { "name": "json_schema_extra", "kind": "attribute", "path": "mongo_ops.registry.BaseDocument.Config.json_schema_extra", "signature": "", "docstring": null } } } } }, "ModelRegistry": { "name": "ModelRegistry", "kind": "class", "path": "mongo_ops.registry.ModelRegistry", "signature": "", "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": "", "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": "", "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": "", "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": "", "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": "", "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": "", "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": "", "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": "", "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)." } } } } }, "repository": { "name": "repository", "kind": "module", "path": "mongo_ops.repository", "signature": null, "docstring": "Repository patterns and CRUD mixins for MongoDB.", "members": { "datetime": { "name": "datetime", "kind": "alias", "path": "mongo_ops.repository.datetime", "signature": "", "docstring": null }, "Any": { "name": "Any", "kind": "alias", "path": "mongo_ops.repository.Any", "signature": "", "docstring": null }, "Dict": { "name": "Dict", "kind": "alias", "path": "mongo_ops.repository.Dict", "signature": "", "docstring": null }, "Generic": { "name": "Generic", "kind": "alias", "path": "mongo_ops.repository.Generic", "signature": "", "docstring": null }, "List": { "name": "List", "kind": "alias", "path": "mongo_ops.repository.List", "signature": "", "docstring": null }, "Optional": { "name": "Optional", "kind": "alias", "path": "mongo_ops.repository.Optional", "signature": "", "docstring": null }, "TypeVar": { "name": "TypeVar", "kind": "alias", "path": "mongo_ops.repository.TypeVar", "signature": "", "docstring": null }, "Union": { "name": "Union", "kind": "alias", "path": "mongo_ops.repository.Union", "signature": "", "docstring": null }, "ObjectId": { "name": "ObjectId", "kind": "alias", "path": "mongo_ops.repository.ObjectId", "signature": "", "docstring": null }, "AsyncIOMotorCollection": { "name": "AsyncIOMotorCollection", "kind": "alias", "path": "mongo_ops.repository.AsyncIOMotorCollection", "signature": "", "docstring": null }, "MongoConnectionManager": { "name": "MongoConnectionManager", "kind": "class", "path": "mongo_ops.repository.MongoConnectionManager", "signature": "", "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.repository.MongoConnectionManager.connect", "signature": "", "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.repository.MongoConnectionManager.disconnect", "signature": "", "docstring": "Close the active MongoDB connection and cleanup resources." }, "get_database": { "name": "get_database", "kind": "function", "path": "mongo_ops.repository.MongoConnectionManager.get_database", "signature": "", "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.repository.MongoConnectionManager.get_client", "signature": "", "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.repository.MongoConnectionManager.lifespan", "signature": "", "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.repository.BaseDocument", "signature": "", "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.repository.BaseDocument.id", "signature": "", "docstring": null }, "created_at": { "name": "created_at", "kind": "attribute", "path": "mongo_ops.repository.BaseDocument.created_at", "signature": "", "docstring": null }, "updated_at": { "name": "updated_at", "kind": "attribute", "path": "mongo_ops.repository.BaseDocument.updated_at", "signature": "", "docstring": null }, "Config": { "name": "Config", "kind": "class", "path": "mongo_ops.repository.BaseDocument.Config", "signature": "", "docstring": null, "members": { "populate_by_name": { "name": "populate_by_name", "kind": "attribute", "path": "mongo_ops.repository.BaseDocument.Config.populate_by_name", "signature": "", "docstring": null }, "arbitrary_types_allowed": { "name": "arbitrary_types_allowed", "kind": "attribute", "path": "mongo_ops.repository.BaseDocument.Config.arbitrary_types_allowed", "signature": "", "docstring": null }, "json_encoders": { "name": "json_encoders", "kind": "attribute", "path": "mongo_ops.repository.BaseDocument.Config.json_encoders", "signature": "", "docstring": null }, "json_schema_extra": { "name": "json_schema_extra", "kind": "attribute", "path": "mongo_ops.repository.BaseDocument.Config.json_schema_extra", "signature": "", "docstring": null } } } } }, "PopulationEngine": { "name": "PopulationEngine", "kind": "class", "path": "mongo_ops.repository.PopulationEngine", "signature": "", "docstring": null, "members": { "register_repo": { "name": "register_repo", "kind": "function", "path": "mongo_ops.repository.PopulationEngine.register_repo", "signature": "", "docstring": null }, "populate": { "name": "populate", "kind": "function", "path": "mongo_ops.repository.PopulationEngine.populate", "signature": "", "docstring": null }, "depopulate": { "name": "depopulate", "kind": "function", "path": "mongo_ops.repository.PopulationEngine.depopulate", "signature": "", "docstring": null } } }, "PopulateRule": { "name": "PopulateRule", "kind": "class", "path": "mongo_ops.repository.PopulateRule", "signature": "", "docstring": null, "members": { "field_name": { "name": "field_name", "kind": "attribute", "path": "mongo_ops.repository.PopulateRule.field_name", "signature": "", "docstring": null }, "collection_name": { "name": "collection_name", "kind": "attribute", "path": "mongo_ops.repository.PopulateRule.collection_name", "signature": "", "docstring": null }, "nested_rules": { "name": "nested_rules", "kind": "attribute", "path": "mongo_ops.repository.PopulateRule.nested_rules", "signature": "", "docstring": null }, "max_depth": { "name": "max_depth", "kind": "attribute", "path": "mongo_ops.repository.PopulateRule.max_depth", "signature": "", "docstring": null }, "filter": { "name": "filter", "kind": "attribute", "path": "mongo_ops.repository.PopulateRule.filter", "signature": "", "docstring": null }, "projection": { "name": "projection", "kind": "attribute", "path": "mongo_ops.repository.PopulateRule.projection", "signature": "", "docstring": null } } }, "T": { "name": "T", "kind": "attribute", "path": "mongo_ops.repository.T", "signature": null, "docstring": null }, "CRUDMixin": { "name": "CRUDMixin", "kind": "class", "path": "mongo_ops.repository.CRUDMixin", "signature": "", "docstring": "Generic CRUD operations mixin for MongoDB collections.\n\nThis mixin provides standard Create, Read, Update, and Delete operations \nthat work with Pydantic models.\n\nAttributes:\n collection: The Motor collection instance.\n model: The Pydantic model class representing the document.", "members": { "collection": { "name": "collection", "kind": "attribute", "path": "mongo_ops.repository.CRUDMixin.collection", "signature": null, "docstring": null }, "model": { "name": "model", "kind": "attribute", "path": "mongo_ops.repository.CRUDMixin.model", "signature": null, "docstring": null }, "data_to_model": { "name": "data_to_model", "kind": "function", "path": "mongo_ops.repository.CRUDMixin.data_to_model", "signature": "", "docstring": null }, "create": { "name": "create", "kind": "function", "path": "mongo_ops.repository.CRUDMixin.create", "signature": "", "docstring": "Create a new document in the collection.\n\nArgs:\n data: The Pydantic model instance to insert.\n\nReturns:\n T: The created Pydantic model instance, including the assigned ID." }, "get_by_id": { "name": "get_by_id", "kind": "function", "path": "mongo_ops.repository.CRUDMixin.get_by_id", "signature": "", "docstring": "Retrieve a document by its ID.\n\nArgs:\n id: The document ID (string or ObjectId).\n\nReturns:\n Optional[T]: The Pydantic model instance if found, else None." }, "get_many": { "name": "get_many", "kind": "function", "path": "mongo_ops.repository.CRUDMixin.get_many", "signature": "", "docstring": "Retrieve multiple documents with filtering, pagination, and sorting.\n\nArgs:\n filter: MongoDB filter dictionary (e.g., {\"is_active\": True}).\n skip: Number of documents to skip for pagination.\n limit: Maximum number of documents to return (default 100).\n sort: List of sort specifications [(field, direction), ...].\n E.g., [(\"created_at\", -1)] for descending.\n\nReturns:\n List[T]: A list of Pydantic model instances.\n\nUsage:\n ```python\n users = await repo.get_many(\n filter={\"role\": \"admin\"},\n limit=10,\n sort=[(\"username\", 1)]\n )\n ```" }, "update": { "name": "update", "kind": "function", "path": "mongo_ops.repository.CRUDMixin.update", "signature": "", "docstring": "Update a document by its ID using the $set operator.\n\nArgs:\n id: The document ID (string or ObjectId).\n data: A dictionary of fields and values to update.\n\nReturns:\n Optional[T]: The updated Pydantic model instance if found, else None.\n\nUsage:\n ```python\n updated_user = await repo.update(user_id, {\"email\": \"new@example.com\"})\n ```" }, "patch": { "name": "patch", "kind": "function", "path": "mongo_ops.repository.CRUDMixin.patch", "signature": "", "docstring": "Partially update a document using $set (REST PATCH semantics).\n\nUnlike update(), patch() takes a partial dict and applies only those\nfields. PopulatingRepository overrides this to prevent patching FK fields.\n\nArgs:\n id: The document ID (string or ObjectId).\n data: A partial dictionary of fields and values to update.\n\nReturns:\n Optional[T]: The updated Pydantic model instance if found, else None." }, "delete": { "name": "delete", "kind": "function", "path": "mongo_ops.repository.CRUDMixin.delete", "signature": "", "docstring": "Delete a document by its ID.\n\nArgs:\n id: The document ID (string or ObjectId).\n\nReturns:\n bool: True if a document was deleted, False otherwise." }, "count": { "name": "count", "kind": "function", "path": "mongo_ops.repository.CRUDMixin.count", "signature": "", "docstring": "Count documents matching a filter.\n\nArgs:\n filter: MongoDB filter dictionary.\n\nReturns:\n int: The number of matching documents." } } }, "BaseRepository": { "name": "BaseRepository", "kind": "class", "path": "mongo_ops.repository.BaseRepository", "signature": "", "docstring": "Base repository class combining CRUD operations and collection management.\n\nThis class simplifies repository creation by automatically obtaining the \ndatabase connection and collection instance.\n\nAttributes:\n collection_name: The name of the collection managed by this repository.", "members": { "collection_name": { "name": "collection_name", "kind": "attribute", "path": "mongo_ops.repository.BaseRepository.collection_name", "signature": null, "docstring": null } } }, "PopulatingRepository": { "name": "PopulatingRepository", "kind": "class", "path": "mongo_ops.repository.PopulatingRepository", "signature": "", "docstring": null, "members": { "population_engine": { "name": "population_engine", "kind": "attribute", "path": "mongo_ops.repository.PopulatingRepository.population_engine", "signature": null, "docstring": null }, "set_population_engine": { "name": "set_population_engine", "kind": "function", "path": "mongo_ops.repository.PopulatingRepository.set_population_engine", "signature": "", "docstring": null }, "set_populate_rules": { "name": "set_populate_rules", "kind": "function", "path": "mongo_ops.repository.PopulatingRepository.set_populate_rules", "signature": "", "docstring": null }, "data_to_model": { "name": "data_to_model", "kind": "function", "path": "mongo_ops.repository.PopulatingRepository.data_to_model", "signature": "", "docstring": null }, "create": { "name": "create", "kind": "function", "path": "mongo_ops.repository.PopulatingRepository.create", "signature": "", "docstring": null }, "update": { "name": "update", "kind": "function", "path": "mongo_ops.repository.PopulatingRepository.update", "signature": "", "docstring": null }, "patch": { "name": "patch", "kind": "function", "path": "mongo_ops.repository.PopulatingRepository.patch", "signature": "", "docstring": null } } } } }, "transactions": { "name": "transactions", "kind": "module", "path": "mongo_ops.transactions", "signature": null, "docstring": "Transaction management helpers for MongoDB.", "members": { "Awaitable": { "name": "Awaitable", "kind": "alias", "path": "mongo_ops.transactions.Awaitable", "signature": "", "docstring": null }, "asynccontextmanager": { "name": "asynccontextmanager", "kind": "alias", "path": "mongo_ops.transactions.asynccontextmanager", "signature": "", "docstring": null }, "Any": { "name": "Any", "kind": "alias", "path": "mongo_ops.transactions.Any", "signature": "", "docstring": null }, "Callable": { "name": "Callable", "kind": "alias", "path": "mongo_ops.transactions.Callable", "signature": "", "docstring": null }, "List": { "name": "List", "kind": "alias", "path": "mongo_ops.transactions.List", "signature": "", "docstring": null }, "AsyncIOMotorClientSession": { "name": "AsyncIOMotorClientSession", "kind": "alias", "path": "mongo_ops.transactions.AsyncIOMotorClientSession", "signature": "", "docstring": null }, "MongoConnectionManager": { "name": "MongoConnectionManager", "kind": "class", "path": "mongo_ops.transactions.MongoConnectionManager", "signature": "", "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.transactions.MongoConnectionManager.connect", "signature": "", "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.transactions.MongoConnectionManager.disconnect", "signature": "", "docstring": "Close the active MongoDB connection and cleanup resources." }, "get_database": { "name": "get_database", "kind": "function", "path": "mongo_ops.transactions.MongoConnectionManager.get_database", "signature": "", "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.transactions.MongoConnectionManager.get_client", "signature": "", "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.transactions.MongoConnectionManager.lifespan", "signature": "", "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" } } }, "TransactionManager": { "name": "TransactionManager", "kind": "class", "path": "mongo_ops.transactions.TransactionManager", "signature": "", "docstring": "Simplified multi-document transaction handling.\n\nThis class provides helpers for executing operations within a MongoDB \ntransaction, ensuring ACID compliance for multi-document updates.", "members": { "start_session": { "name": "start_session", "kind": "function", "path": "mongo_ops.transactions.TransactionManager.start_session", "signature": "", "docstring": "Start a transaction session as an async context manager.\n\nArgs:\n **kwargs: Transaction options (e.g., read_concern, write_concern).\n\nYields:\n AsyncIOMotorClientSession: The active session with a started transaction.\n\nUsage:\n async with TransactionManager.start_session() as session:\n await collection.insert_one(doc, session=session)\n await other_collection.update_one(filter, update, session=session)" }, "execute_transaction": { "name": "execute_transaction", "kind": "function", "path": "mongo_ops.transactions.TransactionManager.execute_transaction", "signature": "", "docstring": "Execute multiple operations within a single transaction.\n\nArgs:\n operations: A list of async callables that accept a session \n parameter and return a result.\n **kwargs: Transaction options.\n\nReturns:\n List[Any]: A list containing the results of each operation.\n\nUsage:\n results = await TransactionManager.execute_transaction([\n lambda s: repo1.create(data1, session=s),\n lambda s: repo2.update(id, data2, session=s),\n ])" } } } } }, "cache": { "name": "cache", "kind": "module", "path": "mongo_ops.cache", "signature": null, "docstring": null, "members": { "CacheBackend": { "name": "CacheBackend", "kind": "class", "path": "mongo_ops.cache.CacheBackend", "signature": "", "docstring": null, "members": { "get": { "name": "get", "kind": "function", "path": "mongo_ops.cache.CacheBackend.get", "signature": "", "docstring": null }, "set": { "name": "set", "kind": "function", "path": "mongo_ops.cache.CacheBackend.set", "signature": "", "docstring": null }, "delete": { "name": "delete", "kind": "function", "path": "mongo_ops.cache.CacheBackend.delete", "signature": "", "docstring": null }, "exists": { "name": "exists", "kind": "function", "path": "mongo_ops.cache.CacheBackend.exists", "signature": "", "docstring": null }, "clear_pattern": { "name": "clear_pattern", "kind": "function", "path": "mongo_ops.cache.CacheBackend.clear_pattern", "signature": "", "docstring": null }, "get_stats": { "name": "get_stats", "kind": "function", "path": "mongo_ops.cache.CacheBackend.get_stats", "signature": "", "docstring": null }, "initialize": { "name": "initialize", "kind": "function", "path": "mongo_ops.cache.CacheBackend.initialize", "signature": "", "docstring": null }, "shutdown": { "name": "shutdown", "kind": "function", "path": "mongo_ops.cache.CacheBackend.shutdown", "signature": "", "docstring": null } } }, "CacheStats": { "name": "CacheStats", "kind": "class", "path": "mongo_ops.cache.CacheStats", "signature": "", "docstring": null, "members": { "hits": { "name": "hits", "kind": "attribute", "path": "mongo_ops.cache.CacheStats.hits", "signature": "", "docstring": null }, "misses": { "name": "misses", "kind": "attribute", "path": "mongo_ops.cache.CacheStats.misses", "signature": "", "docstring": null }, "sets": { "name": "sets", "kind": "attribute", "path": "mongo_ops.cache.CacheStats.sets", "signature": "", "docstring": null }, "deletes": { "name": "deletes", "kind": "attribute", "path": "mongo_ops.cache.CacheStats.deletes", "signature": "", "docstring": null }, "current_size": { "name": "current_size", "kind": "attribute", "path": "mongo_ops.cache.CacheStats.current_size", "signature": "", "docstring": null }, "max_size": { "name": "max_size", "kind": "attribute", "path": "mongo_ops.cache.CacheStats.max_size", "signature": "", "docstring": null } } }, "CircularReferenceError": { "name": "CircularReferenceError", "kind": "class", "path": "mongo_ops.cache.CircularReferenceError", "signature": "", "docstring": null, "members": { "collection": { "name": "collection", "kind": "attribute", "path": "mongo_ops.cache.CircularReferenceError.collection", "signature": "", "docstring": null }, "doc_id": { "name": "doc_id", "kind": "attribute", "path": "mongo_ops.cache.CircularReferenceError.doc_id", "signature": "", "docstring": null }, "path": { "name": "path", "kind": "attribute", "path": "mongo_ops.cache.CircularReferenceError.path", "signature": "", "docstring": null } } }, "CacheConfig": { "name": "CacheConfig", "kind": "class", "path": "mongo_ops.cache.CacheConfig", "signature": "", "docstring": null, "members": { "enabled": { "name": "enabled", "kind": "attribute", "path": "mongo_ops.cache.CacheConfig.enabled", "signature": "", "docstring": null }, "backend": { "name": "backend", "kind": "attribute", "path": "mongo_ops.cache.CacheConfig.backend", "signature": "", "docstring": null }, "redis_client": { "name": "redis_client", "kind": "attribute", "path": "mongo_ops.cache.CacheConfig.redis_client", "signature": "", "docstring": null }, "default_ttl": { "name": "default_ttl", "kind": "attribute", "path": "mongo_ops.cache.CacheConfig.default_ttl", "signature": "", "docstring": null }, "max_entries": { "name": "max_entries", "kind": "attribute", "path": "mongo_ops.cache.CacheConfig.max_entries", "signature": "", "docstring": null }, "key_prefix": { "name": "key_prefix", "kind": "attribute", "path": "mongo_ops.cache.CacheConfig.key_prefix", "signature": "", "docstring": null }, "cleanup_interval": { "name": "cleanup_interval", "kind": "attribute", "path": "mongo_ops.cache.CacheConfig.cleanup_interval", "signature": "", "docstring": null } } }, "InMemoryCacheBackend": { "name": "InMemoryCacheBackend", "kind": "class", "path": "mongo_ops.cache.InMemoryCacheBackend", "signature": "", "docstring": null, "members": { "initialize": { "name": "initialize", "kind": "function", "path": "mongo_ops.cache.InMemoryCacheBackend.initialize", "signature": "", "docstring": null }, "shutdown": { "name": "shutdown", "kind": "function", "path": "mongo_ops.cache.InMemoryCacheBackend.shutdown", "signature": "", "docstring": null }, "get": { "name": "get", "kind": "function", "path": "mongo_ops.cache.InMemoryCacheBackend.get", "signature": "", "docstring": null }, "set": { "name": "set", "kind": "function", "path": "mongo_ops.cache.InMemoryCacheBackend.set", "signature": "", "docstring": null }, "delete": { "name": "delete", "kind": "function", "path": "mongo_ops.cache.InMemoryCacheBackend.delete", "signature": "", "docstring": null }, "exists": { "name": "exists", "kind": "function", "path": "mongo_ops.cache.InMemoryCacheBackend.exists", "signature": "", "docstring": null }, "clear_pattern": { "name": "clear_pattern", "kind": "function", "path": "mongo_ops.cache.InMemoryCacheBackend.clear_pattern", "signature": "", "docstring": null }, "get_stats": { "name": "get_stats", "kind": "function", "path": "mongo_ops.cache.InMemoryCacheBackend.get_stats", "signature": "", "docstring": null } } }, "backend": { "name": "backend", "kind": "module", "path": "mongo_ops.cache.backend", "signature": null, "docstring": "Cache backend abstraction.", "members": { "ABC": { "name": "ABC", "kind": "alias", "path": "mongo_ops.cache.backend.ABC", "signature": "", "docstring": null }, "abstractmethod": { "name": "abstractmethod", "kind": "alias", "path": "mongo_ops.cache.backend.abstractmethod", "signature": "", "docstring": null }, "dataclass": { "name": "dataclass", "kind": "alias", "path": "mongo_ops.cache.backend.dataclass", "signature": "", "docstring": null }, "Optional": { "name": "Optional", "kind": "alias", "path": "mongo_ops.cache.backend.Optional", "signature": "", "docstring": null }, "ObjectId": { "name": "ObjectId", "kind": "alias", "path": "mongo_ops.cache.backend.ObjectId", "signature": "", "docstring": null }, "CacheStats": { "name": "CacheStats", "kind": "class", "path": "mongo_ops.cache.backend.CacheStats", "signature": "", "docstring": null, "members": { "hits": { "name": "hits", "kind": "attribute", "path": "mongo_ops.cache.backend.CacheStats.hits", "signature": null, "docstring": null }, "misses": { "name": "misses", "kind": "attribute", "path": "mongo_ops.cache.backend.CacheStats.misses", "signature": null, "docstring": null }, "sets": { "name": "sets", "kind": "attribute", "path": "mongo_ops.cache.backend.CacheStats.sets", "signature": null, "docstring": null }, "deletes": { "name": "deletes", "kind": "attribute", "path": "mongo_ops.cache.backend.CacheStats.deletes", "signature": null, "docstring": null }, "current_size": { "name": "current_size", "kind": "attribute", "path": "mongo_ops.cache.backend.CacheStats.current_size", "signature": null, "docstring": null }, "max_size": { "name": "max_size", "kind": "attribute", "path": "mongo_ops.cache.backend.CacheStats.max_size", "signature": null, "docstring": null } } }, "CircularReferenceError": { "name": "CircularReferenceError", "kind": "class", "path": "mongo_ops.cache.backend.CircularReferenceError", "signature": "", "docstring": null, "members": { "collection": { "name": "collection", "kind": "attribute", "path": "mongo_ops.cache.backend.CircularReferenceError.collection", "signature": null, "docstring": null }, "doc_id": { "name": "doc_id", "kind": "attribute", "path": "mongo_ops.cache.backend.CircularReferenceError.doc_id", "signature": null, "docstring": null }, "path": { "name": "path", "kind": "attribute", "path": "mongo_ops.cache.backend.CircularReferenceError.path", "signature": null, "docstring": null } } }, "CacheBackend": { "name": "CacheBackend", "kind": "class", "path": "mongo_ops.cache.backend.CacheBackend", "signature": "", "docstring": null, "members": { "get": { "name": "get", "kind": "function", "path": "mongo_ops.cache.backend.CacheBackend.get", "signature": "", "docstring": null }, "set": { "name": "set", "kind": "function", "path": "mongo_ops.cache.backend.CacheBackend.set", "signature": "", "docstring": null }, "delete": { "name": "delete", "kind": "function", "path": "mongo_ops.cache.backend.CacheBackend.delete", "signature": "", "docstring": null }, "exists": { "name": "exists", "kind": "function", "path": "mongo_ops.cache.backend.CacheBackend.exists", "signature": "", "docstring": null }, "clear_pattern": { "name": "clear_pattern", "kind": "function", "path": "mongo_ops.cache.backend.CacheBackend.clear_pattern", "signature": "", "docstring": null }, "get_stats": { "name": "get_stats", "kind": "function", "path": "mongo_ops.cache.backend.CacheBackend.get_stats", "signature": "", "docstring": null }, "initialize": { "name": "initialize", "kind": "function", "path": "mongo_ops.cache.backend.CacheBackend.initialize", "signature": "", "docstring": null }, "shutdown": { "name": "shutdown", "kind": "function", "path": "mongo_ops.cache.backend.CacheBackend.shutdown", "signature": "", "docstring": null } } } } }, "config": { "name": "config", "kind": "module", "path": "mongo_ops.cache.config", "signature": null, "docstring": "Cache configuration.", "members": { "dataclass": { "name": "dataclass", "kind": "alias", "path": "mongo_ops.cache.config.dataclass", "signature": "", "docstring": null }, "Literal": { "name": "Literal", "kind": "alias", "path": "mongo_ops.cache.config.Literal", "signature": "", "docstring": null }, "Optional": { "name": "Optional", "kind": "alias", "path": "mongo_ops.cache.config.Optional", "signature": "", "docstring": null }, "Redis": { "name": "Redis", "kind": "alias", "path": "mongo_ops.cache.config.Redis", "signature": "", "docstring": null }, "CacheConfig": { "name": "CacheConfig", "kind": "class", "path": "mongo_ops.cache.config.CacheConfig", "signature": "", "docstring": null, "members": { "enabled": { "name": "enabled", "kind": "attribute", "path": "mongo_ops.cache.config.CacheConfig.enabled", "signature": null, "docstring": null }, "backend": { "name": "backend", "kind": "attribute", "path": "mongo_ops.cache.config.CacheConfig.backend", "signature": null, "docstring": null }, "redis_client": { "name": "redis_client", "kind": "attribute", "path": "mongo_ops.cache.config.CacheConfig.redis_client", "signature": null, "docstring": null }, "default_ttl": { "name": "default_ttl", "kind": "attribute", "path": "mongo_ops.cache.config.CacheConfig.default_ttl", "signature": null, "docstring": null }, "max_entries": { "name": "max_entries", "kind": "attribute", "path": "mongo_ops.cache.config.CacheConfig.max_entries", "signature": null, "docstring": null }, "key_prefix": { "name": "key_prefix", "kind": "attribute", "path": "mongo_ops.cache.config.CacheConfig.key_prefix", "signature": null, "docstring": null }, "cleanup_interval": { "name": "cleanup_interval", "kind": "attribute", "path": "mongo_ops.cache.config.CacheConfig.cleanup_interval", "signature": null, "docstring": null } } } } }, "in_memory": { "name": "in_memory", "kind": "module", "path": "mongo_ops.cache.in_memory", "signature": null, "docstring": null, "members": { "asyncio": { "name": "asyncio", "kind": "alias", "path": "mongo_ops.cache.in_memory.asyncio", "signature": "", "docstring": null }, "heapq": { "name": "heapq", "kind": "alias", "path": "mongo_ops.cache.in_memory.heapq", "signature": "", "docstring": null }, "json": { "name": "json", "kind": "alias", "path": "mongo_ops.cache.in_memory.json", "signature": "", "docstring": null }, "OrderedDict": { "name": "OrderedDict", "kind": "alias", "path": "mongo_ops.cache.in_memory.OrderedDict", "signature": "", "docstring": null }, "datetime": { "name": "datetime", "kind": "alias", "path": "mongo_ops.cache.in_memory.datetime", "signature": "", "docstring": null }, "timedelta": { "name": "timedelta", "kind": "alias", "path": "mongo_ops.cache.in_memory.timedelta", "signature": "", "docstring": null }, "timezone": { "name": "timezone", "kind": "alias", "path": "mongo_ops.cache.in_memory.timezone", "signature": "", "docstring": null }, "Optional": { "name": "Optional", "kind": "alias", "path": "mongo_ops.cache.in_memory.Optional", "signature": "", "docstring": null }, "CacheBackend": { "name": "CacheBackend", "kind": "class", "path": "mongo_ops.cache.in_memory.CacheBackend", "signature": "", "docstring": null, "members": { "get": { "name": "get", "kind": "function", "path": "mongo_ops.cache.in_memory.CacheBackend.get", "signature": "", "docstring": null }, "set": { "name": "set", "kind": "function", "path": "mongo_ops.cache.in_memory.CacheBackend.set", "signature": "", "docstring": null }, "delete": { "name": "delete", "kind": "function", "path": "mongo_ops.cache.in_memory.CacheBackend.delete", "signature": "", "docstring": null }, "exists": { "name": "exists", "kind": "function", "path": "mongo_ops.cache.in_memory.CacheBackend.exists", "signature": "", "docstring": null }, "clear_pattern": { "name": "clear_pattern", "kind": "function", "path": "mongo_ops.cache.in_memory.CacheBackend.clear_pattern", "signature": "", "docstring": null }, "get_stats": { "name": "get_stats", "kind": "function", "path": "mongo_ops.cache.in_memory.CacheBackend.get_stats", "signature": "", "docstring": null }, "initialize": { "name": "initialize", "kind": "function", "path": "mongo_ops.cache.in_memory.CacheBackend.initialize", "signature": "", "docstring": null }, "shutdown": { "name": "shutdown", "kind": "function", "path": "mongo_ops.cache.in_memory.CacheBackend.shutdown", "signature": "", "docstring": null } } }, "CacheStats": { "name": "CacheStats", "kind": "class", "path": "mongo_ops.cache.in_memory.CacheStats", "signature": "", "docstring": null, "members": { "hits": { "name": "hits", "kind": "attribute", "path": "mongo_ops.cache.in_memory.CacheStats.hits", "signature": "", "docstring": null }, "misses": { "name": "misses", "kind": "attribute", "path": "mongo_ops.cache.in_memory.CacheStats.misses", "signature": "", "docstring": null }, "sets": { "name": "sets", "kind": "attribute", "path": "mongo_ops.cache.in_memory.CacheStats.sets", "signature": "", "docstring": null }, "deletes": { "name": "deletes", "kind": "attribute", "path": "mongo_ops.cache.in_memory.CacheStats.deletes", "signature": "", "docstring": null }, "current_size": { "name": "current_size", "kind": "attribute", "path": "mongo_ops.cache.in_memory.CacheStats.current_size", "signature": "", "docstring": null }, "max_size": { "name": "max_size", "kind": "attribute", "path": "mongo_ops.cache.in_memory.CacheStats.max_size", "signature": "", "docstring": null } } }, "InMemoryCacheBackend": { "name": "InMemoryCacheBackend", "kind": "class", "path": "mongo_ops.cache.in_memory.InMemoryCacheBackend", "signature": "", "docstring": null, "members": { "initialize": { "name": "initialize", "kind": "function", "path": "mongo_ops.cache.in_memory.InMemoryCacheBackend.initialize", "signature": "", "docstring": null }, "shutdown": { "name": "shutdown", "kind": "function", "path": "mongo_ops.cache.in_memory.InMemoryCacheBackend.shutdown", "signature": "", "docstring": null }, "get": { "name": "get", "kind": "function", "path": "mongo_ops.cache.in_memory.InMemoryCacheBackend.get", "signature": "", "docstring": null }, "set": { "name": "set", "kind": "function", "path": "mongo_ops.cache.in_memory.InMemoryCacheBackend.set", "signature": "", "docstring": null }, "delete": { "name": "delete", "kind": "function", "path": "mongo_ops.cache.in_memory.InMemoryCacheBackend.delete", "signature": "", "docstring": null }, "exists": { "name": "exists", "kind": "function", "path": "mongo_ops.cache.in_memory.InMemoryCacheBackend.exists", "signature": "", "docstring": null }, "clear_pattern": { "name": "clear_pattern", "kind": "function", "path": "mongo_ops.cache.in_memory.InMemoryCacheBackend.clear_pattern", "signature": "", "docstring": null }, "get_stats": { "name": "get_stats", "kind": "function", "path": "mongo_ops.cache.in_memory.InMemoryCacheBackend.get_stats", "signature": "", "docstring": null } } }, "encode_value": { "name": "encode_value", "kind": "function", "path": "mongo_ops.cache.in_memory.encode_value", "signature": "", "docstring": null }, "decode_value": { "name": "decode_value", "kind": "function", "path": "mongo_ops.cache.in_memory.decode_value", "signature": "", "docstring": null } } }, "redis_backend": { "name": "redis_backend", "kind": "module", "path": "mongo_ops.cache.redis_backend", "signature": null, "docstring": null, "members": { "json": { "name": "json", "kind": "alias", "path": "mongo_ops.cache.redis_backend.json", "signature": "", "docstring": null }, "Optional": { "name": "Optional", "kind": "alias", "path": "mongo_ops.cache.redis_backend.Optional", "signature": "", "docstring": null }, "CacheBackend": { "name": "CacheBackend", "kind": "class", "path": "mongo_ops.cache.redis_backend.CacheBackend", "signature": "", "docstring": null, "members": { "get": { "name": "get", "kind": "function", "path": "mongo_ops.cache.redis_backend.CacheBackend.get", "signature": "", "docstring": null }, "set": { "name": "set", "kind": "function", "path": "mongo_ops.cache.redis_backend.CacheBackend.set", "signature": "", "docstring": null }, "delete": { "name": "delete", "kind": "function", "path": "mongo_ops.cache.redis_backend.CacheBackend.delete", "signature": "", "docstring": null }, "exists": { "name": "exists", "kind": "function", "path": "mongo_ops.cache.redis_backend.CacheBackend.exists", "signature": "", "docstring": null }, "clear_pattern": { "name": "clear_pattern", "kind": "function", "path": "mongo_ops.cache.redis_backend.CacheBackend.clear_pattern", "signature": "", "docstring": null }, "get_stats": { "name": "get_stats", "kind": "function", "path": "mongo_ops.cache.redis_backend.CacheBackend.get_stats", "signature": "", "docstring": null }, "initialize": { "name": "initialize", "kind": "function", "path": "mongo_ops.cache.redis_backend.CacheBackend.initialize", "signature": "", "docstring": null }, "shutdown": { "name": "shutdown", "kind": "function", "path": "mongo_ops.cache.redis_backend.CacheBackend.shutdown", "signature": "", "docstring": null } } }, "CacheStats": { "name": "CacheStats", "kind": "class", "path": "mongo_ops.cache.redis_backend.CacheStats", "signature": "", "docstring": null, "members": { "hits": { "name": "hits", "kind": "attribute", "path": "mongo_ops.cache.redis_backend.CacheStats.hits", "signature": "", "docstring": null }, "misses": { "name": "misses", "kind": "attribute", "path": "mongo_ops.cache.redis_backend.CacheStats.misses", "signature": "", "docstring": null }, "sets": { "name": "sets", "kind": "attribute", "path": "mongo_ops.cache.redis_backend.CacheStats.sets", "signature": "", "docstring": null }, "deletes": { "name": "deletes", "kind": "attribute", "path": "mongo_ops.cache.redis_backend.CacheStats.deletes", "signature": "", "docstring": null }, "current_size": { "name": "current_size", "kind": "attribute", "path": "mongo_ops.cache.redis_backend.CacheStats.current_size", "signature": "", "docstring": null }, "max_size": { "name": "max_size", "kind": "attribute", "path": "mongo_ops.cache.redis_backend.CacheStats.max_size", "signature": "", "docstring": null } } }, "Redis": { "name": "Redis", "kind": "alias", "path": "mongo_ops.cache.redis_backend.Redis", "signature": "", "docstring": null }, "RedisCacheBackend": { "name": "RedisCacheBackend", "kind": "class", "path": "mongo_ops.cache.redis_backend.RedisCacheBackend", "signature": "", "docstring": null, "members": { "initialize": { "name": "initialize", "kind": "function", "path": "mongo_ops.cache.redis_backend.RedisCacheBackend.initialize", "signature": "", "docstring": null }, "shutdown": { "name": "shutdown", "kind": "function", "path": "mongo_ops.cache.redis_backend.RedisCacheBackend.shutdown", "signature": "", "docstring": null }, "get": { "name": "get", "kind": "function", "path": "mongo_ops.cache.redis_backend.RedisCacheBackend.get", "signature": "", "docstring": null }, "set": { "name": "set", "kind": "function", "path": "mongo_ops.cache.redis_backend.RedisCacheBackend.set", "signature": "", "docstring": null }, "delete": { "name": "delete", "kind": "function", "path": "mongo_ops.cache.redis_backend.RedisCacheBackend.delete", "signature": "", "docstring": null }, "exists": { "name": "exists", "kind": "function", "path": "mongo_ops.cache.redis_backend.RedisCacheBackend.exists", "signature": "", "docstring": null }, "clear_pattern": { "name": "clear_pattern", "kind": "function", "path": "mongo_ops.cache.redis_backend.RedisCacheBackend.clear_pattern", "signature": "", "docstring": null }, "get_stats": { "name": "get_stats", "kind": "function", "path": "mongo_ops.cache.redis_backend.RedisCacheBackend.get_stats", "signature": "", "docstring": null }, "publish_invalidate": { "name": "publish_invalidate", "kind": "function", "path": "mongo_ops.cache.redis_backend.RedisCacheBackend.publish_invalidate", "signature": "", "docstring": null } } }, "encode_value": { "name": "encode_value", "kind": "function", "path": "mongo_ops.cache.redis_backend.encode_value", "signature": "", "docstring": null }, "decode_value": { "name": "decode_value", "kind": "function", "path": "mongo_ops.cache.redis_backend.decode_value", "signature": "", "docstring": null } } }, "repository": { "name": "repository", "kind": "module", "path": "mongo_ops.cache.repository", "signature": null, "docstring": null, "members": { "Generic": { "name": "Generic", "kind": "alias", "path": "mongo_ops.cache.repository.Generic", "signature": "", "docstring": null }, "List": { "name": "List", "kind": "alias", "path": "mongo_ops.cache.repository.List", "signature": "", "docstring": null }, "Optional": { "name": "Optional", "kind": "alias", "path": "mongo_ops.cache.repository.Optional", "signature": "", "docstring": null }, "TypeVar": { "name": "TypeVar", "kind": "alias", "path": "mongo_ops.cache.repository.TypeVar", "signature": "", "docstring": null }, "Union": { "name": "Union", "kind": "alias", "path": "mongo_ops.cache.repository.Union", "signature": "", "docstring": null }, "ObjectId": { "name": "ObjectId", "kind": "alias", "path": "mongo_ops.cache.repository.ObjectId", "signature": "", "docstring": null }, "BaseDocument": { "name": "BaseDocument", "kind": "class", "path": "mongo_ops.cache.repository.BaseDocument", "signature": "", "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.cache.repository.BaseDocument.id", "signature": "", "docstring": null }, "created_at": { "name": "created_at", "kind": "attribute", "path": "mongo_ops.cache.repository.BaseDocument.created_at", "signature": "", "docstring": null }, "updated_at": { "name": "updated_at", "kind": "attribute", "path": "mongo_ops.cache.repository.BaseDocument.updated_at", "signature": "", "docstring": null }, "Config": { "name": "Config", "kind": "class", "path": "mongo_ops.cache.repository.BaseDocument.Config", "signature": "", "docstring": null, "members": { "populate_by_name": { "name": "populate_by_name", "kind": "attribute", "path": "mongo_ops.cache.repository.BaseDocument.Config.populate_by_name", "signature": "", "docstring": null }, "arbitrary_types_allowed": { "name": "arbitrary_types_allowed", "kind": "attribute", "path": "mongo_ops.cache.repository.BaseDocument.Config.arbitrary_types_allowed", "signature": "", "docstring": null }, "json_encoders": { "name": "json_encoders", "kind": "attribute", "path": "mongo_ops.cache.repository.BaseDocument.Config.json_encoders", "signature": "", "docstring": null }, "json_schema_extra": { "name": "json_schema_extra", "kind": "attribute", "path": "mongo_ops.cache.repository.BaseDocument.Config.json_schema_extra", "signature": "", "docstring": null } } } } }, "BaseRepository": { "name": "BaseRepository", "kind": "class", "path": "mongo_ops.cache.repository.BaseRepository", "signature": "", "docstring": "Base repository class combining CRUD operations and collection management.\n\nThis class simplifies repository creation by automatically obtaining the \ndatabase connection and collection instance.\n\nAttributes:\n collection_name: The name of the collection managed by this repository.", "members": { "collection_name": { "name": "collection_name", "kind": "attribute", "path": "mongo_ops.cache.repository.BaseRepository.collection_name", "signature": "", "docstring": null } } }, "CacheBackend": { "name": "CacheBackend", "kind": "class", "path": "mongo_ops.cache.repository.CacheBackend", "signature": "", "docstring": null, "members": { "get": { "name": "get", "kind": "function", "path": "mongo_ops.cache.repository.CacheBackend.get", "signature": "", "docstring": null }, "set": { "name": "set", "kind": "function", "path": "mongo_ops.cache.repository.CacheBackend.set", "signature": "", "docstring": null }, "delete": { "name": "delete", "kind": "function", "path": "mongo_ops.cache.repository.CacheBackend.delete", "signature": "", "docstring": null }, "exists": { "name": "exists", "kind": "function", "path": "mongo_ops.cache.repository.CacheBackend.exists", "signature": "", "docstring": null }, "clear_pattern": { "name": "clear_pattern", "kind": "function", "path": "mongo_ops.cache.repository.CacheBackend.clear_pattern", "signature": "", "docstring": null }, "get_stats": { "name": "get_stats", "kind": "function", "path": "mongo_ops.cache.repository.CacheBackend.get_stats", "signature": "", "docstring": null }, "initialize": { "name": "initialize", "kind": "function", "path": "mongo_ops.cache.repository.CacheBackend.initialize", "signature": "", "docstring": null }, "shutdown": { "name": "shutdown", "kind": "function", "path": "mongo_ops.cache.repository.CacheBackend.shutdown", "signature": "", "docstring": null } } }, "CacheConfig": { "name": "CacheConfig", "kind": "class", "path": "mongo_ops.cache.repository.CacheConfig", "signature": "", "docstring": null, "members": { "enabled": { "name": "enabled", "kind": "attribute", "path": "mongo_ops.cache.repository.CacheConfig.enabled", "signature": "", "docstring": null }, "backend": { "name": "backend", "kind": "attribute", "path": "mongo_ops.cache.repository.CacheConfig.backend", "signature": "", "docstring": null }, "redis_client": { "name": "redis_client", "kind": "attribute", "path": "mongo_ops.cache.repository.CacheConfig.redis_client", "signature": "", "docstring": null }, "default_ttl": { "name": "default_ttl", "kind": "attribute", "path": "mongo_ops.cache.repository.CacheConfig.default_ttl", "signature": "", "docstring": null }, "max_entries": { "name": "max_entries", "kind": "attribute", "path": "mongo_ops.cache.repository.CacheConfig.max_entries", "signature": "", "docstring": null }, "key_prefix": { "name": "key_prefix", "kind": "attribute", "path": "mongo_ops.cache.repository.CacheConfig.key_prefix", "signature": "", "docstring": null }, "cleanup_interval": { "name": "cleanup_interval", "kind": "attribute", "path": "mongo_ops.cache.repository.CacheConfig.cleanup_interval", "signature": "", "docstring": null } } }, "decode_value": { "name": "decode_value", "kind": "function", "path": "mongo_ops.cache.repository.decode_value", "signature": "", "docstring": null }, "encode_value": { "name": "encode_value", "kind": "function", "path": "mongo_ops.cache.repository.encode_value", "signature": "", "docstring": null }, "T": { "name": "T", "kind": "attribute", "path": "mongo_ops.cache.repository.T", "signature": null, "docstring": null }, "CachedBaseRepository": { "name": "CachedBaseRepository", "kind": "class", "path": "mongo_ops.cache.repository.CachedBaseRepository", "signature": "", "docstring": null, "members": { "get_by_id": { "name": "get_by_id", "kind": "function", "path": "mongo_ops.cache.repository.CachedBaseRepository.get_by_id", "signature": "", "docstring": null }, "create": { "name": "create", "kind": "function", "path": "mongo_ops.cache.repository.CachedBaseRepository.create", "signature": "", "docstring": null }, "update": { "name": "update", "kind": "function", "path": "mongo_ops.cache.repository.CachedBaseRepository.update", "signature": "", "docstring": null }, "delete": { "name": "delete", "kind": "function", "path": "mongo_ops.cache.repository.CachedBaseRepository.delete", "signature": "", "docstring": null }, "warm_cache": { "name": "warm_cache", "kind": "function", "path": "mongo_ops.cache.repository.CachedBaseRepository.warm_cache", "signature": "", "docstring": null }, "invalidate_cache": { "name": "invalidate_cache", "kind": "function", "path": "mongo_ops.cache.repository.CachedBaseRepository.invalidate_cache", "signature": "", "docstring": null } } } } } } }, "populate": { "name": "populate", "kind": "module", "path": "mongo_ops.populate", "signature": null, "docstring": null, "members": { "PopulationEngine": { "name": "PopulationEngine", "kind": "class", "path": "mongo_ops.populate.PopulationEngine", "signature": "", "docstring": null, "members": { "register_repo": { "name": "register_repo", "kind": "function", "path": "mongo_ops.populate.PopulationEngine.register_repo", "signature": "", "docstring": null }, "populate": { "name": "populate", "kind": "function", "path": "mongo_ops.populate.PopulationEngine.populate", "signature": "", "docstring": null }, "depopulate": { "name": "depopulate", "kind": "function", "path": "mongo_ops.populate.PopulationEngine.depopulate", "signature": "", "docstring": null } } }, "PopulateRule": { "name": "PopulateRule", "kind": "class", "path": "mongo_ops.populate.PopulateRule", "signature": "", "docstring": null, "members": { "field_name": { "name": "field_name", "kind": "attribute", "path": "mongo_ops.populate.PopulateRule.field_name", "signature": "", "docstring": null }, "collection_name": { "name": "collection_name", "kind": "attribute", "path": "mongo_ops.populate.PopulateRule.collection_name", "signature": "", "docstring": null }, "nested_rules": { "name": "nested_rules", "kind": "attribute", "path": "mongo_ops.populate.PopulateRule.nested_rules", "signature": "", "docstring": null }, "max_depth": { "name": "max_depth", "kind": "attribute", "path": "mongo_ops.populate.PopulateRule.max_depth", "signature": "", "docstring": null }, "filter": { "name": "filter", "kind": "attribute", "path": "mongo_ops.populate.PopulateRule.filter", "signature": "", "docstring": null }, "projection": { "name": "projection", "kind": "attribute", "path": "mongo_ops.populate.PopulateRule.projection", "signature": "", "docstring": null } } }, "engine": { "name": "engine", "kind": "module", "path": "mongo_ops.populate.engine", "signature": null, "docstring": null, "members": { "Any": { "name": "Any", "kind": "alias", "path": "mongo_ops.populate.engine.Any", "signature": "", "docstring": null }, "Dict": { "name": "Dict", "kind": "alias", "path": "mongo_ops.populate.engine.Dict", "signature": "", "docstring": null }, "List": { "name": "List", "kind": "alias", "path": "mongo_ops.populate.engine.List", "signature": "", "docstring": null }, "Optional": { "name": "Optional", "kind": "alias", "path": "mongo_ops.populate.engine.Optional", "signature": "", "docstring": null }, "Set": { "name": "Set", "kind": "alias", "path": "mongo_ops.populate.engine.Set", "signature": "", "docstring": null }, "Tuple": { "name": "Tuple", "kind": "alias", "path": "mongo_ops.populate.engine.Tuple", "signature": "", "docstring": null }, "TypeVar": { "name": "TypeVar", "kind": "alias", "path": "mongo_ops.populate.engine.TypeVar", "signature": "", "docstring": null }, "ObjectId": { "name": "ObjectId", "kind": "alias", "path": "mongo_ops.populate.engine.ObjectId", "signature": "", "docstring": null }, "CircularReferenceError": { "name": "CircularReferenceError", "kind": "class", "path": "mongo_ops.populate.engine.CircularReferenceError", "signature": "", "docstring": null, "members": { "collection": { "name": "collection", "kind": "attribute", "path": "mongo_ops.populate.engine.CircularReferenceError.collection", "signature": "", "docstring": null }, "doc_id": { "name": "doc_id", "kind": "attribute", "path": "mongo_ops.populate.engine.CircularReferenceError.doc_id", "signature": "", "docstring": null }, "path": { "name": "path", "kind": "attribute", "path": "mongo_ops.populate.engine.CircularReferenceError.path", "signature": "", "docstring": null } } }, "BaseDocument": { "name": "BaseDocument", "kind": "class", "path": "mongo_ops.populate.engine.BaseDocument", "signature": "", "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.populate.engine.BaseDocument.id", "signature": "", "docstring": null }, "created_at": { "name": "created_at", "kind": "attribute", "path": "mongo_ops.populate.engine.BaseDocument.created_at", "signature": "", "docstring": null }, "updated_at": { "name": "updated_at", "kind": "attribute", "path": "mongo_ops.populate.engine.BaseDocument.updated_at", "signature": "", "docstring": null }, "Config": { "name": "Config", "kind": "class", "path": "mongo_ops.populate.engine.BaseDocument.Config", "signature": "", "docstring": null, "members": { "populate_by_name": { "name": "populate_by_name", "kind": "attribute", "path": "mongo_ops.populate.engine.BaseDocument.Config.populate_by_name", "signature": "", "docstring": null }, "arbitrary_types_allowed": { "name": "arbitrary_types_allowed", "kind": "attribute", "path": "mongo_ops.populate.engine.BaseDocument.Config.arbitrary_types_allowed", "signature": "", "docstring": null }, "json_encoders": { "name": "json_encoders", "kind": "attribute", "path": "mongo_ops.populate.engine.BaseDocument.Config.json_encoders", "signature": "", "docstring": null }, "json_schema_extra": { "name": "json_schema_extra", "kind": "attribute", "path": "mongo_ops.populate.engine.BaseDocument.Config.json_schema_extra", "signature": "", "docstring": null } } } } }, "PopulateRule": { "name": "PopulateRule", "kind": "class", "path": "mongo_ops.populate.engine.PopulateRule", "signature": "", "docstring": null, "members": { "field_name": { "name": "field_name", "kind": "attribute", "path": "mongo_ops.populate.engine.PopulateRule.field_name", "signature": "", "docstring": null }, "collection_name": { "name": "collection_name", "kind": "attribute", "path": "mongo_ops.populate.engine.PopulateRule.collection_name", "signature": "", "docstring": null }, "nested_rules": { "name": "nested_rules", "kind": "attribute", "path": "mongo_ops.populate.engine.PopulateRule.nested_rules", "signature": "", "docstring": null }, "max_depth": { "name": "max_depth", "kind": "attribute", "path": "mongo_ops.populate.engine.PopulateRule.max_depth", "signature": "", "docstring": null }, "filter": { "name": "filter", "kind": "attribute", "path": "mongo_ops.populate.engine.PopulateRule.filter", "signature": "", "docstring": null }, "projection": { "name": "projection", "kind": "attribute", "path": "mongo_ops.populate.engine.PopulateRule.projection", "signature": "", "docstring": null } } }, "T": { "name": "T", "kind": "attribute", "path": "mongo_ops.populate.engine.T", "signature": null, "docstring": null }, "PopulationEngine": { "name": "PopulationEngine", "kind": "class", "path": "mongo_ops.populate.engine.PopulationEngine", "signature": "", "docstring": null, "members": { "register_repo": { "name": "register_repo", "kind": "function", "path": "mongo_ops.populate.engine.PopulationEngine.register_repo", "signature": "", "docstring": null }, "populate": { "name": "populate", "kind": "function", "path": "mongo_ops.populate.engine.PopulationEngine.populate", "signature": "", "docstring": null }, "depopulate": { "name": "depopulate", "kind": "function", "path": "mongo_ops.populate.engine.PopulationEngine.depopulate", "signature": "", "docstring": null } } } } }, "rules": { "name": "rules", "kind": "module", "path": "mongo_ops.populate.rules", "signature": null, "docstring": null, "members": { "dataclass": { "name": "dataclass", "kind": "alias", "path": "mongo_ops.populate.rules.dataclass", "signature": "", "docstring": null }, "Any": { "name": "Any", "kind": "alias", "path": "mongo_ops.populate.rules.Any", "signature": "", "docstring": null }, "Dict": { "name": "Dict", "kind": "alias", "path": "mongo_ops.populate.rules.Dict", "signature": "", "docstring": null }, "List": { "name": "List", "kind": "alias", "path": "mongo_ops.populate.rules.List", "signature": "", "docstring": null }, "Optional": { "name": "Optional", "kind": "alias", "path": "mongo_ops.populate.rules.Optional", "signature": "", "docstring": null }, "PopulateRule": { "name": "PopulateRule", "kind": "class", "path": "mongo_ops.populate.rules.PopulateRule", "signature": "", "docstring": null, "members": { "field_name": { "name": "field_name", "kind": "attribute", "path": "mongo_ops.populate.rules.PopulateRule.field_name", "signature": null, "docstring": null }, "collection_name": { "name": "collection_name", "kind": "attribute", "path": "mongo_ops.populate.rules.PopulateRule.collection_name", "signature": null, "docstring": null }, "nested_rules": { "name": "nested_rules", "kind": "attribute", "path": "mongo_ops.populate.rules.PopulateRule.nested_rules", "signature": null, "docstring": null }, "max_depth": { "name": "max_depth", "kind": "attribute", "path": "mongo_ops.populate.rules.PopulateRule.max_depth", "signature": null, "docstring": null }, "filter": { "name": "filter", "kind": "attribute", "path": "mongo_ops.populate.rules.PopulateRule.filter", "signature": null, "docstring": null }, "projection": { "name": "projection", "kind": "attribute", "path": "mongo_ops.populate.rules.PopulateRule.projection", "signature": null, "docstring": null } } } } } } } } } }