[SERVER-56572] Allow ranking-style window functions over a compound set of sortBy fields Created: 03/May/21 Updated: 09/Jan/24 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Nicholas Zolnierz | Assignee: | Backlog - Query Optimization |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Assigned Teams: |
Query Optimization
|
||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
Ranking-style functions are currently only allowed with single-field sortBy specs, since the implementation re-uses existing accumulator machinery under the hood which operates over single values at a time. One potential workaround is to prepend an $addFields stage that places the compound set of fields into their own sub-object, then applying the window function rank on that new object. |
| Comments |
| Comment by Teddy ALBINA [ 09/Jan/24 ] |
|
It's a major issue for us not to be able to use rank and $documentNumber when sorting on multiple fields |
| Comment by Sam Patterson [ 20/Feb/22 ] |
|
Hi, this issue is something that's preventing us from upgrading to MongoDB 5.0, we'd love to make use of the $rank feature but not being able to specify multiple sort fields is kind of a non-starter for us as it means we can't use another field for breaking ties. Is this something that is likely to be implemented soon? |