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

aggregate() in Explainable object does not work with an object as argument

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 0.14.0
    • Affects Version/s: None
    • Component/s: Shell API
    • None
    • Iteration Chicago
    • Not Needed

      Problem Description

      aggregate() can take either an object with a single stage or an array with multiple stages. This should be true both for the aggregate() method of a collection as well as for the aggregate() method of Explainable. However, it's not true for the latter and the error message is confusing.

      Given the error, this might be an issue in the driver.

      Steps to Reproduce

      Run db.users.explain().aggregate({$match: {email: /@gmail.com/)}}

      Expected Results

      The explain plan for that one-stage pipeline.

      Actual Results

      MongoError: Unrecognized pipeline stage name: 'explain'

      Additional Notes

            Assignee:
            michael.rose@mongodb.com Michael Rose (Inactive)
            Reporter:
            massimiliano.marcon@mongodb.com Massimiliano Marcon
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: