How can I get those n dataset with the highest *count* but return them sorted by name?

I tried the following, but that does not work.

```
db.Foo
      .find()
      .sort({'count': -1})
      .limit(n)
      .sort({'name': 1}) // does not work
      .exec(...);

```

Is there any other solution besides manually sorting the returned json array?

Such like subqueries in SQL?

```
SELECT *
FROM
( SELECT *
  FROM Foo
  ORDER BY count DESC
  LIMIT n
) AS tmp
ORDER BY name ASC ;

```