def getOneStudentJson(college_code='1mv',year='14',branch='is',regno=45):
client = MongoClient()
db = client.results
students = db.students
student = students.find_one({"usn" : (college_code + year
+branch + str(regno).zfill(3)).upper()})
if student:
return dumps(student) #dumps is used to convert bson format of mongodb to json
else :
student = student_results(college_code,year,branch,regno)
db.students.insert_one(student)
return dumps(student)
评论列表
文章目录