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

[v7.2+] Verify that $documents inside $lookup fails to parse

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

      This ticket concerns a pipeline like the following:

      db.foo.aggregate([{$lookup: {from: "bar", pipeline: [{$documents: []}], as: "baz"}}])
      

      Up until version 7.2, this pipeline was allowed, even though the from: "bar" piece isn't meaningful and should not be present. In SERVER-69836 (v7.2+) we started enforcing the namespacing rules better, making this pipeline return an error (which is still true on version 8.0 and on the master branch).

      In versions before 7.2, this pipeline is legal and works correctly, ignoring the namespace. However, it confuses the code to compute the query shape, which causes the pipeline to return an error if and only if query stats is enabled (internalQueryStatsRateLimit parameter != 0). This is obviously a bug - query stats should not change the validation rules.

      This ticket tracks the work to increase our test coverage for this scenario on the master branch. The validation is correct. See the linked ticket for fixes to the earlier branches.

            Assignee:
            charlie.swanson@mongodb.com Charlie Swanson
            Reporter:
            charlie.swanson@mongodb.com Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: