Investigate propagating subpipeline stage constraint failures to error messages

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Consider the following integration test:

         assert.commandWorked(
              testDb.createView("my_view", "my_coll_1", [{$vectorSearch: {}}]));    
         const pipeline = [
              {
                  $lookup: {
                      from: "my_coll_2",
                      pipeline: [
                          {$unionWith: "my_view"},
                      ],
                      as: "combined",
                  },
              },
          ];    
          coll.aggregate(pipeline).toArray(); 

      This test fails as it should ($vectorSearch isn't allowed inside of $lookup) but with a confusing error message: "$unionWith is not allowed within a $lookup's sub-pipeline". Here is where this error is thrown. I believe the fix would involve propagating the constraint failure to the top-level "src" ($unionWith).

       

            Assignee:
            Unassigned
            Reporter:
            Josh Siegel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: