import time


def get_agg_log(db, sessionID, start='', end=''):
    """
    Retrieve all Collection entries in a given time frame.
    :param db: The database object.
    :param sessionID: Current user's session ID.
    :param start: (Optional) The start of the time frame.
    :param end: (Optional) The end of the time frame.
    :return: A list of entries in a given time frame.
    """
    agg_collection = db['agg_collection_' + sessionID]

    result = []

    if start == '':
        start = 0.0
    if end == '':
        end = time.time()

    query = agg_collection.find({
        '$and': [
            {'start': {'$gt': start}},
            {'start': {'$lt': end}}
        ]
    })

    for entry in query:
        result.append(entry)

    return result