Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-98002

Timeseries metadata $project + $sort incorrectly pushes $sort before bucket unpack

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Integration
    • 200

      This example pipeline has different result ordering (by the $sort) with optimizations on vs. off, where "tag" is the meta field:

      [{"$project": {"tag.assistant": 0}},
       {"$sort": {"tag": 1}}] 

       

      With optimizations on, the $sort is pushed before the bucket unpack, even though the $sort is dependent on the $project since it modifies the meta field.

      In the timeseries rewrite logic, this query has haveComputedMetaField false, meaning it is allowed to proceed with the sort reorder (createMetadataSortForReorder()), even though the meta field is modified before $sort.

            Assignee:
            will.buerger@mongodb.com Will Buerger
            Reporter:
            will.buerger@mongodb.com Will Buerger
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: