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 e19f79f commit d014b0c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions API/database.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
python
from datetime import datetime

from pymongo import MongoClient


Expand All @@ -9,7 +10,7 @@ def __init__(self, uri="mongodb://localhost:27017/", db_name="ImageDB"):
self.db = self.client[db_name]

def find(self, collection, query=None):
return list(self.db[collection].find(query))
return self.db[collection].find(query)

def insert_one(self, collection, document):
return self.db[collection].insert_one(document)
Expand All @@ -20,5 +21,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, filter, update):
return self.db[collection].update_one(filter, 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 d014b0c

Please sign in to comment.