Add debug statement
This commit is contained in:
@@ -44,4 +44,4 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
auth_controller.set_on_login(handle_login)
|
auth_controller.set_on_login(handle_login)
|
||||||
|
|
||||||
app.run(host="0.0.0.0", port=5000, debug=True)
|
app.run(host="0.0.0.0", port=5000, debug=True, use_reloader=False)
|
||||||
|
|||||||
@@ -15,14 +15,20 @@ class MongoService:
|
|||||||
|
|
||||||
|
|
||||||
def insert(self, collection : str, data : object):
|
def insert(self, collection : str, data : object):
|
||||||
|
try :
|
||||||
collection = self._db[collection]
|
collection = self._db[collection]
|
||||||
payload = self._to_document(data)
|
payload = self._to_document(data)
|
||||||
result = collection.insert_one(payload)
|
result = collection.insert_one(payload)
|
||||||
return result.inserted_id
|
return result.inserted_id
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
def find(self, collection: str, field: str, value):
|
def find(self, collection: str, field: str, value):
|
||||||
col = self._db[collection]
|
try :
|
||||||
return list(col.find({field: value}))
|
collection = self._db[collection]
|
||||||
|
return list(collection.find({field: value}))
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
def _to_document(self, obj):
|
def _to_document(self, obj):
|
||||||
if obj is None or isinstance(obj, (str, int, float, bool)):
|
if obj is None or isinstance(obj, (str, int, float, bool)):
|
||||||
|
|||||||
Reference in New Issue
Block a user