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

[v7.0] $documents inside $lookup fails to parse with QueryStats

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.0.16, 6.0.20
    • Affects Version/s: 6.0.17, 7.0.14
    • Component/s: None
    • Query Integration
    • Fully Compatible
    • ALL
    • v6.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.

            Assignee:
            charlie.swanson@mongodb.com Charlie Swanson
            Reporter:
            arun.banala@mongodb.com Arun Banala
            Votes:
            0 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved: