Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/query/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,12 @@ Query.prototype = new (function () {
throw new Error(p + ' is not a valid field for ' +
this.model.modelName);
}
// alias for `asc`(1) and `desc`(-1)
if (val == 1) {
val = 'asc';
} else if (val == -1) {
val = 'desc';
}
if (!(val == 'asc' || val == 'desc')) {
throw new Error('Sort directon for ' + p +
' field on ' + validatedField.modelName + ' must be ' +
Expand Down