How to sort json file ascending in pymongo?

0 votes
I want to sort json file Ascending or Descending after connect on pymongo, and I have this problem ...

when is use this code :

or this code :

cars ="price", DESCENDING)

I got this message :

<pymongo.cursor.Cursor object at 0x7f4b50315890>
Aug 14, 2019 in Python by Ahmed
• 310 points

1 answer to this question.

0 votes

Hey Ahmad, you can get the output by iterating over your curser.

for row in cars
answered Aug 14, 2019 by Trisha