diff --git a/API/database.py b/API/database.py index a6f8c64..0809248 100644 --- a/API/database.py +++ b/API/database.py @@ -1,14 +1,16 @@ python from datetime import datetime + from pymongo import MongoClient + class Database: def __init__(self, uri="mongodb://localhost:27017/", db_name="ImageDB"): self.client = MongoClient(uri) self.db = self.client[db_name] - def find(self, collection, query=None, projection=None): - return self.db[collection].find(query, projection) + def find(self, collection, query=None): + return list(self.db[collection].find(query)) def insert_one(self, collection, document): return self.db[collection].insert_one(document) @@ -20,4 +22,4 @@ 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, update) \ No newline at end of file + return self.db[collection].update_one(query, {"$set": update}) \ No newline at end of file