Sortieren von "populated documents" in Mongoose ODM

Heute bin ich auf die Frage gestoßen, wie man populated documents  in Mongoose sortiert. Die Antwort fand ich hier  . Zunächst ist der Aufruf von populate wichtig: 1 Model.find().populate(path, fields, conditions, **options**); Und als “options” kann man nun die sortierung hinterlegen: 1 2 3 4 5 6 7 { sort: 'order' } // ascending { sort: [['order', 1 ]] } // ascending { sort: [['order', 'asc' ]] } // ascending { sort: [['order', 'desc' ]] } // ascending { sort: [['order', -1 ]] } // descending { sort: [['order', 'desc' ]] } // descending { sort: [['order', 'descending' ]] } // descending