def get_all_users(show_teachers=False):
"""
Finds all the users in the database
Args:
show_teachers: whether or not to include teachers in the response
Returns:
Returns the uid, username, and email of all users.
"""
db = api.common.get_conn()
match = {}
projection = {"uid": 1, "username": 1, "email": 1, "tid": 1}
if not show_teachers:
match.update({"teacher": False})
projection.update({"teacher": 1})
return list(db.users.find(match, projection))
评论列表
文章目录