Example #1
0
 def update(self, obj: Operation) -> int:
     return self.connection[DATABASE][COLLECTION_OPERATION].update_one(
         filter={
             'idx': obj.idx
         },
         update={
             '$set': obj.convert_to_db_format()
         }).modified_count
Example #2
0
 def create(self, obj: Operation) -> int:
     return self.connection[DATABASE][COLLECTION_OPERATION].insert_one(
         document=obj.convert_to_db_format()).inserted_id