Skip to content

Commit

Permalink
Updated the file in response to the PR comment
Browse files Browse the repository at this point in the history
  • Loading branch information
codeshwar-preview[bot] authored Mar 16, 2024
1 parent 80b3f41 commit b0608ab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions API/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from datetime import datetime
from pymongo import MongoClient


class Database:
def __init__(self, uri="mongodb://localhost:27017/", db_name="ImageDB"):
self.client = MongoClient(uri)
Expand All @@ -19,5 +20,5 @@ def find_one(self, collection, filter, projection=None):
def find_one_and_delete(self, collection, query):
return self.db[collection].find_one_and_delete(query)

def update_one(self, collection, query, update):
return self.db[collection].update_one(query, {"$set": update})
def update_one(self, collection, query, update, upsert=False):
return self.db[collection].update_one(filter=query, update=update, upsert=upsert)

0 comments on commit b0608ab

Please sign in to comment.