-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(query): add options
parameter to Query.prototype.sort()
#14375
Conversation
This looks good to me. Can we also add the documentation for the 2nd parameter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
As for the "condition boolean checks instead of truthy" issue, i am impartial, as i think both methods are being used in mongoose and not anything specific is set to be used.
Fix #14365
Summary
Right now,
sort(null)
is a no-op. There's no good way to unset the current sort option other thandelete query.getOptions().sort
, which works but looks a bit janky. This PR addsq.sort(null, { override: true })
, theoverride
option lets you explicitly override the current sort.Examples