123456789101112131415161718192021222324 |
- from abc import ABC
- from typing import Dict
- from motor import motor_asyncio
- class MongoUtil(ABC):
-
- def __init__(self):
- '''
- init mongo client
- '''
- super(MongoDB, self).__init__();
- self.client=motor_asyncio.AsyncIOMotorClient(connection_url)
- self.collection = client[""]
- async def update(self, record: Dict):
- return await self.collection.update_one(record)
- async def add(self, record: Dict):
- return await self.collection.insert_one(record)
- async def delete(self, record: Dict):
- # return await self.collection.
- pass
|