My data looks like this:
{
"name":"dan",
"somestring":"asdf",
"friends":[
{
"name": "carl",
"height":180,
...
},
{
"name": "john",
"height":165,
...
},
{
"name": "jim",
"height":170,
...
}
]
},
...
I would like retrieve the document where the friends are sorted by height descending.
I tried db.getCollection('users').find({"name" : "dan"}, {"friends" : 1}).sort({"friends.height" : -1})
but the friends list stays the same.
EDIT: I messed up the structure of my data, I fixed the array to look like an array...