diff --git a/routers/general.py b/routers/general.py index c9f750b..916f753 100644 --- a/routers/general.py +++ b/routers/general.py @@ -46,8 +46,7 @@ async def health(): pipeline = [ {"$match": {}}, - {"$addFields": {"randInt": {"$randInt": {}}}}, - {"$sort": {"randInt": 1}}, + {"$sample": {"size": 3}}, {"$limit": 5}, ] random_filers = database.search_filers(pipeline) diff --git a/routers/lib/database.py b/routers/lib/database.py index 44fc9e4..a33d9ab 100644 --- a/routers/lib/database.py +++ b/routers/lib/database.py @@ -15,7 +15,7 @@ MONGO_SERVER_URL = os.environ["MONGO_SERVER_URL"] logging.info("[ Database (MongoDB) Initializing ] ...") -client = MongoClient(MONGO_SERVER_URL, tlsAllowInvalidCertificates=True) +client = MongoClient(MONGO_SERVER_URL) db = client["wallstreetlocal"] logs = db["logs"] diff --git a/routers/utils.py b/routers/utils.py index 9bfc815..c4e4858 100644 --- a/routers/utils.py +++ b/routers/utils.py @@ -31,7 +31,7 @@ def get_confirm_token(response): def save_response_content(response, destination, chunk_size): with open(destination, "wb") as f: - size = int(response.headers["Content-Length"]) / (10**6) + size = int(response.headers["Content-Length"] + 10**6) / (10**6) mb_chunk = chunk_size / (10**6) progress = tqdm(total=size, desc="Downloading Database", unit="mb") for i, chunk in enumerate(response.iter_content(chunk_size)):