-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: BSON
spokodev has created PR #4988: fix: preserve $meta direction in [field, direction] sort pair in node-mongodb-native
Implementation provided by the external reporter looks accurate. Tuple format of [Sort, SortDirection] fails on a valid member provided as the SortDirection { $meta: ... }
Use Case
As a driver user
I want to be able to sort by meta when providing sort pairs of field & direction
So that I can leverage textscore sorting appropriately
User Experience
- Cursor sorts should be { $meta } aware as a sort direction when doing a sort off of pair values (e.g: public entry points of FindCursor.sort())
- Today: When trying to sort using $meta, sortdirection is essentially ignored (the sort semantics of a textscore are ignored entirely)
Expected behaviour: Textscore should be honoured with a sort pair, not ignored as a consequence of wrapping the value in an array (improperly) when passed to prepareDirection
Dependencies
- N/A
Risks/Unknowns
- None
Acceptance Criteria
Implementation Requirements
- Support meta in sortDirection
Testing Requirements
- Regression test for meta in sort direction should be added
Documentation Requirements
- No docs changes – this aligns with documentation
- Release note for the fix crediting user
Follow Up Requirements
- N/A