| 123456789101112131415161718192021222324252627282930 |
- # from pymongo import MongoClient
- class Utils:
- def __init__(self, col="test"):
- self.GET = 1
- self.UPD = 2
- self.CLS = 3
- self.EXC = 4
- # self.cli = MongoClient("mongodb://chassis:chassis@127.0.0.1:27017/")
- # self.db = self.cli["chassis"]
- # self.col = col
- # async def insert(self, parm):
- # self.db[self.col].insert_many(parm)
- # await self.cli.close()
- # async def find(self, cond):
- # ret = self.db[self.col].find({}, cond)
- # await self.cli.close()
- # return ret
- # async def delete(self, cond):
- # self.db[self.col].delete_many(cond)
- # await self.cli.close()
- # async def update(self, cond):
- # self.db[self.col].update_many(cond)
- # await self.cli.close()
|