Files
docs/mcp/mongo-ops/modules/mongo_ops.transactions.json
Vishesh 'ironeagle' Bangotra 49a00351bb docs: collect mongo-ops lib (mkdocstrings) + wiki into separate site subpaths, fix mcp server name, expose port 8007
- 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
2026-09-14 22:33:34 +05:30

118 lines
7.3 KiB
JSON

{
"module": "mongo_ops.transactions",
"content": {
"path": "mongo_ops.transactions",
"docstring": "Transaction management helpers for MongoDB.",
"objects": {
"Awaitable": {
"name": "Awaitable",
"kind": "alias",
"path": "mongo_ops.transactions.Awaitable",
"signature": "<bound method Alias.signature of Alias('Awaitable', 'collections.abc.Awaitable')>",
"docstring": null
},
"asynccontextmanager": {
"name": "asynccontextmanager",
"kind": "alias",
"path": "mongo_ops.transactions.asynccontextmanager",
"signature": "<bound method Alias.signature of Alias('asynccontextmanager', 'contextlib.asynccontextmanager')>",
"docstring": null
},
"Any": {
"name": "Any",
"kind": "alias",
"path": "mongo_ops.transactions.Any",
"signature": "<bound method Alias.signature of Alias('Any', 'typing.Any')>",
"docstring": null
},
"Callable": {
"name": "Callable",
"kind": "alias",
"path": "mongo_ops.transactions.Callable",
"signature": "<bound method Alias.signature of Alias('Callable', 'typing.Callable')>",
"docstring": null
},
"List": {
"name": "List",
"kind": "alias",
"path": "mongo_ops.transactions.List",
"signature": "<bound method Alias.signature of Alias('List', 'typing.List')>",
"docstring": null
},
"AsyncIOMotorClientSession": {
"name": "AsyncIOMotorClientSession",
"kind": "alias",
"path": "mongo_ops.transactions.AsyncIOMotorClientSession",
"signature": "<bound method Alias.signature of Alias('AsyncIOMotorClientSession', 'motor.motor_asyncio.AsyncIOMotorClientSession')>",
"docstring": null
},
"MongoConnectionManager": {
"name": "MongoConnectionManager",
"kind": "class",
"path": "mongo_ops.transactions.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.transactions.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.transactions.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.transactions.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.transactions.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.transactions.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"
}
}
},
"TransactionManager": {
"name": "TransactionManager",
"kind": "class",
"path": "mongo_ops.transactions.TransactionManager",
"signature": "<bound method Class.signature of Class('TransactionManager', 11, 69)>",
"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": "<bound method Function.signature of Function('start_session', 19, 39)>",
"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": "<bound method Function.signature of Function('execute_transaction', 41, 69)>",
"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 ])"
}
}
}
}
}
}