BREAKING CHANGE: stop using mquery for updateX()
, deleteX()
, sort()
, always convert sort args to objects
#13777
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Re: #13617
Summary
Unfortunately there's a lot of functionality duplicated between mongoose and mquery, so with #13617 we're moving towards moving this logic into mongoose for easier maintenance. The big change in this PR is
sort()
: we've moved sort handling into Mongoose, and we're makingoptions.sort
always an object. We're now converting.sort([['a', 1]])
into.sort({ a: 1 })
, rather than leaving it as[['a', 1]]
under the hood. Keeping entries-style syntax internally is not necessary post ES2015, key order is still maintained, and that removes the need for us to handle edge cases like.sort([['a', 1]]).sort({ b: 1 })
.Examples