add libraries and clean up

This commit is contained in:
osiris account 2023-03-12 13:11:37 -07:00
parent 10fde4b2fc
commit 6fd3fe78cb

View File

@ -44,9 +44,7 @@ async def retrieve_top_balances(top_number: int, env_vars: dict) -> list:
"""Retrieve top balances from the database."""
collection = _get_db_collection(env_vars)
# todo: need to sort? how to optimzie to not return all?
# something like for post in posts.find({"date": {"$lt": d}}).sort("author"):
top_balances = collection.find()
top_balances = collection.find().sort({"balance": {"$lt": top_number}}, pymongo.DESCENDING)
result = []
counter = 0