pyhon中如何有序获取mongodb表中某字段

在mongodb中的查询语句 :
db[table].find({value},{"selectcolum":1} ).sort({"itemname":1});升序

db[table].find({value},{"selectcolum":1}).sort({"itemname":-1});降序
在python中的实际操作 :
db[table].find({value},{"selectcolum":1}).sort([("itemname",1)]);升序                
db[table].find({value},{"selectcolum":1}).sort([("itemname",-1)]);降序


你可能感兴趣的:(pyhon中如何有序获取mongodb表中某字段)