Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1317

Explain for aggregation executed as "executionStats" even if not requested

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.0.0
    • Affects Version/s: 1.6.0
    • Component/s: Explain
    • Labels:
      None
    • Environment:
      OS:
      node.js / npm versions:
      Additional info:
    • 1
    • Not Needed
    • Iteration Iguanodon

      Legacy shell does not allow to add explain after the aggregation command (e.g. db.foo.aggregate([.....]).explain(). mongosh allows that but the behaviour is not consistent.

      The following aggregation is executed as expected without the "executionStats" option

      db.foo.aggregate([{$match: {a:4}}, {$match: {$expr: { $eq: [{$last: "$a"},4]}}}]).explain()
      

      Instead the following aggregation even if we don't have the option executionStats it's executed as the option was there (not expected).

      db.foo.aggregate([{$match: {a:4}},{$project: {a: {$last: "$a"}}},{$match: {a:4}}]).explain()
      

      Note that this does not happen if we use the syntax db.foo.explain().aggregation([....])

            Assignee:
            kevin.mas@mongodb.com Kevin Mas Ruiz
            Reporter:
            renato.riccio@mongodb.com Renato Riccio
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: