我正在尝试nr
从名为prob
现在看起来像这样的 mongo 数据库集合中获取最高值:
{
"_id": {
"$oid": "5ae9d062f36d282906c59736"
},
"nr": 1,
"nume": "numeunu",
"enunt": "-",
"datedeintrare": "-",
"datedeiesire": "-"
}
{
"_id": {
"$oid": "5ae9f190f36d282906c5b461"
},
"nr": 2,
"nume": "numedoi",
"enunt": "-",
"datedeintrare": "-",
"datedeiesire": "-"
}
我的测试烧瓶代码是:
@app.route('/test')
def testaree():
prob = mongo.db.prob
return prob.find().sort({"nr":-1}).limit(1)
但它给了我一个错误TypeError: if no direction is specified, key_or_list must be an instance of list