import pymongo
import sys
client = pymongo.MongoClient('localhost', 27017)
db = client.school
scores = db.score
def find():
print "find using dot notation"
query = {}
selector = {'media.oembed.url': 1, '_id':0}
try:
# cursor = scores.find(query).sort('student_id', pymongo.ASCENDING).skip(4).limit(5)
cursor = scores.find(query).sort([('student_id', pymongo.ASCENDING), ('scores', pymongo.DESCENDING)]).limit(10)
except:
print "Unexpected error", sys.exc_info()[0]
limit = 0
for doc in cursor:
print doc
limit += 1
if (limit > 10):
break