diff --git a/middleware/app_be/services/mongodbservice.py b/middleware/app_be/services/mongodbservice.py index a473f2c..b44d6ef 100644 --- a/middleware/app_be/services/mongodbservice.py +++ b/middleware/app_be/services/mongodbservice.py @@ -1,5 +1,4 @@ from app_be.views.mongo_db import MongoManager -from django.http import JsonResponse from app_be.services.hashservice import create_sha512 @@ -20,12 +19,15 @@ class MongoDBService: db = instance.AIC col = db.metadata + resp = [] try: - for resp in col.find(): - print(resp) + for meta in col.find(): + del meta['_id'] + resp.append(meta) except: print("Could not find Metadata") + return resp @staticmethod diff --git a/middleware/app_be/views/rest_api.py b/middleware/app_be/views/rest_api.py index 3162aa2..b6f4a65 100644 --- a/middleware/app_be/views/rest_api.py +++ b/middleware/app_be/views/rest_api.py @@ -35,7 +35,7 @@ class ImageEndpoint: metadata = MongoDBService.getAll() print(metadata) - return JsonResponse({'Result': 'success1'}, safe=False) + return JsonResponse(metadata, safe=False) @staticmethod @api_view(['GET'])