$rankFusion must be the first stage of the pipeline

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 8.1.0-rc0, 8.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Integration
    • Fully Compatible
    • v8.1
    • 200
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      db.coll.aggregate([{$match: {b: 3}}, {$rankFusion: {input: {pipelines: {a: [{$sort: {_id: 1}}]}}}}])

       

      That pipeline works even though it should reject it for $rankFusion not being the first stage of the pipeline.

      We'd been relying on validation that $search/$vectorSearch/$geoNear must be the first stage of the pipeline. But if the first input pipeline is a custom-sorted pipeline without one of those stages, it won't have any validation to make sure $rankFusion was first. I believe "StageConstraints" on DocumentSourceRankFusion is unreachable code. We only call constraints() after desugaring

            Assignee:
            Joe Shalabi
            Reporter:
            Will Buerger
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: