I'm using pymongo: http://api.mongodb.org/python/1.9%2B/index.html
for post in db.datasets.find({"set":"flickr"}).sort("num_favs","-1"):
...
How come I can't sort this? I'd like it sorted descending.
每个密钥对中的第二项必须为ASCENDING,DESCENDING或GEO2D
使用.sort("num_favs",-1)
代替,"-1"
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.