method returns all job records from a particular collection that are older than <since>

def get_all(self, collection_name, since=None):
        """ method returns all job records from a particular collection that are older than <since> """
        if since is None:
            query = {}
        else:
            query = {job.TIMEPERIOD: {'$gte': since}}
        collection = self.ds.connection(collection_name)

        cursor = collection.find(query)
        if cursor.count() == 0:
            raise LookupError('MongoDB has no job records in collection {0} since {1}'.format(collection_name, since))
        return [Job.from_json(document) for document in cursor]