user upsert

This commit is contained in:
耿伦伦
2021-11-30 23:59:35 +08:00
parent bb16fadb40
commit a1f523f07e
4 changed files with 9 additions and 3 deletions

View File

@ -10,6 +10,9 @@ class MongoStore:
def set_collection(self, collection):
self.collection = self.db[collection]
def replace_one(self, condition, data, upsert=True):
return self.collection.replace_one(condition, data, upsert=upsert)
def insert_one(self, data):
return self.collection.insert_one(data)