{ "name":"dan", "somestring":"asdf", "friends":[ { "name": "carl", "height":180, ... }, { "name": "john", "height":165, ... }, { "name": "jim", "height":170, ... } ] }, ...
我想检索文件中的朋友是按高度下降排序。
我试过了 db.getCollection('users').find({"name" : "dan"}, {"friends" : 1}).sort({"friends.height" : -1})
db.getCollection('users').find({"name" : "dan"}, {"friends" : 1}).sort({"friends.height" : -1})