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

$rankFusion must be the first stage of the pipeline

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

      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:
            joseph.shalabi@mongodb.com Joe Shalabi
            Reporter:
            will.buerger@mongodb.com Will Buerger
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: