Skip to content

Commit

Permalink
adding support for both spellings
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Kotzen authored and Ryan Kotzen committed Jun 13, 2024
1 parent 2a59428 commit e405304
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/MongoQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ function getSelect(query) {
* @template {Document} TSchema
*/
function getSortOrOrderBy(query) {
const sortStr = query.$orderBy ? query.$orderBy : query.$sort;
const sortStr = query.$orderBy || query.$orderby || query.$sort;
if (!sortStr) {
return null;
}
Expand Down
5 changes: 5 additions & 0 deletions lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ export interface Query<TSchema extends Document> {
* }
* */
$orderBy?: string;
/**
* @deprecated incorrect spelling of $orderBy, will be removed in future
* @alias $orderBy
* */
$ordery?: string;
/**
* $orderBy takes priority over $sort, see it for docs
* @alias $orderBy
Expand Down

0 comments on commit e405304

Please sign in to comment.