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
find.sort() params no longer accept an array #12434
Comments
it seems like 8d917a9 changed the typing of but from what i can tell, arrays were never supported (at least not mentioned in the documentation), see API Docs: |
Hi I have noticed that the documentation was not entirly accurate in the past. However this is a particularly popular post of how to sort using mongoose https://stackoverflow.com/questions/4299991/how-to-sort-in-mongoose and as far as I am aware all of this worked until recently. It is also my underatanding that these are also all the ways you can sort directly in Monogodb itself. |
Any thoughts on if this we be reverted back to allow what it used too or if you will keep the "new" format? Happy to update my code but dont really want to do it if there is no need as we rely on the previous array format a lot. Thanks |
the behavior did not change in runtime, only the types got more strict / more defined, instead of a simple your options are currently:
and then wait for a fix to be released |
… for "query.sort()" fixes Automattic#12434
Prerequisites
Mongoose version
6.6.1
Node.js version
16
MongoDB server version
5.0.12
Description
Hi
I am just upgrading from 6.3.1 to 6.6.1 and I noticed that the sort() funciton params have changed
I can not really find any explenaiton why or even any mention of this change being expected i.e its not in the release notes
It appears to have been done in this commit 8d917a9, feels like a regression but maybe it was intentional?
I used to be able to do
But now it appears it has to be
Steps to Reproduce
Attempt to pass an array of arrays to sort()
Expected Behavior
No response
The text was updated successfully, but these errors were encountered: