def get_all_problems(category=None, show_disabled=False):
"""
Gets all of the problems in the database.
Args:
category: Optional parameter to restrict which problems are returned
show_disabled: Boolean indicating whether or not to show disabled problems.
Returns:
List of problems from the database
"""
db = api.common.get_conn()
match = {}
if category is not None:
match.update({'category': category})
if not show_disabled:
match.update({'disabled': False})
return list(db.problems.find(match, {"_id":0}).sort('score', pymongo.ASCENDING))
评论列表
文章目录