- 
    Type:
Bug
 - 
    Resolution: Fixed
 - 
    Priority:
Major - P3
 - 
    Affects Version/s: 6.0.16, 8.0.0-rc5, 7.0.11
 - 
    Component/s: None
 
- 
        Query Execution
 - 
        Fully Compatible
 - 
        ALL
 - 
        v8.0, v7.0, v6.0
 - 
        
 - 
        QE 2024-05-27
 - 
        (copied to CRM)
 - 
        None
 
- 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 
Hi Team,
Attempting to $sort the results of an $unwind by the array index field (includeArrayIndex) does not sort it properly, unless we add a $set stage (it can be empty) in between. See the included reproduction steps