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

Aggregation shell helper should not modify options document

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.7.3
    • Affects Version/s: None
    • Component/s: Shell
    • Labels:
    • Fully Compatible

      When running this code:

      let collation = {collation: {locale: "fr", backwards: true}};
      db.collection.explain().aggregate([], collation);
      

      The collation document is modified to also have an explain: true field. This is really annoying, because it means I can't use the same options document in multiple commands if an explain is interspersed between them.

      Seems like the bug is in the explain part of the shell code, as db._runAggregate() explicitly makes a copy of the options doc to avoid changing the input parameter.

            Assignee:
            charlie.swanson@mongodb.com Charlie Swanson
            Reporter:
            kyle.suarez@mongodb.com Kyle Suarez
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: