After querying the database of mangodb, it is sorted according to the match field after calculation. Why does it report an error?

reorder according to match field
query code: new_users = self.users.find ({}). Sort ([{"match": 1}]) Picture description

error report:
File "E:pythonprogramvenvlibsite-packagespymongohelpers.py", line 90, in _ index_document

for (key, value) in index_list:

ValueError: not enough values to unpack (expected 2, got 1)

May.22,2021

suggest :

  1. post the Python version
  2. posts a complete program fragment, which can be a function or a strongly related logic block

the code is not very complete and can not provide much information. We can only guess:

  1. The type of index_list is list . If you cannot directly unpack, you can try it: for k, v in enumerate (index_list)
  2. The type of index_list is list (tuple) . The value of tuple cannot guarantee that all unpack, can be for item in index_list and then unpack
  3. inside the loop.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e40705-448c2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e40705-448c2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?