close mongo connection

This commit is contained in:
耿伦伦
2021-12-01 23:44:25 +08:00
parent 481c2f8b6b
commit d61800b755
12 changed files with 21 additions and 3 deletions

View File

@ -7,6 +7,9 @@ class MongoStore:
self.client = pymongo.MongoClient(config()['mongo']['uri'])
self.db = self.client[config()['mongo']['dbname']]
def close(self):
self.client.close()
def set_collection(self, collection):
self.collection = self.db[collection]