0

I get an error: Too many values to unpack. and then also:

self.__ordering = helpers._index_document(keys)

NOTE: I tried to make use of this link.

Python ValueError: too many values to unpack

Code is as following:

docs = grades.find({'type':"homework",'student_id':i})
docs = docs.sort(['score',-1])
counter = grades.find({'type':"homework",'student_id':i})
counter = counter.sort(['score',-1]).count()
Community
  • 1
  • 1
sapio_l
  • 21
  • 7

1 Answers1

0

This:

docs = docs.sort(['score',-1])

Should be this:

docs = docs.sort([('score',-1)])

Or this:

docs = docs.sort('score',-1)

See the docs here.

Bernie Hackett
  • 8,749
  • 1
  • 27
  • 20