I would like to sort my Group
-Model by the name
of the departure_country
with mongoose-paginate and NodeJS.
My Group-Schema:
var GroupSchema = new Schema({
name: String,
flight_date: Date,
....
departure_country: {type: Schema.ObjectId, ref: 'Country'},
....
});
The Country-Schema:
var CountrySchema = new Schema({
name: String,
code: String,
});
Using the sortBy
-option of mongoose-paginate sorts by the country's _ids
and I don't know how to tell it to sort by the name
.