db.js trying to reassign const

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Cannot Reproduce
    • Priority: Major - P3
    • None
    • Affects Version/s: 4.0.0
    • Component/s: Shell
    • None
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      I'm using mongo shell 4.0.0 against MongoDB 2.4.9 to run an aggregation pipeline but it fails with this error:

      E QUERY    [js] TypeError: invalid assignment to const `res' :
      DB.prototype._runAggregate@src/mongo/shell/db.js:250:19 

      I had a look at the source code and it looks like res is being declared as a constant on line 242

      const res = doAgg(cmdObj);

      but is being reassigned on line 250.  The problem may be that the version of MongoDB I'm using is way older than the client but, in my limited knowledge of Javascript, a const cannot be reassigned

      I can reproduce the error with this example query:

      db.users.aggregate([{
          $match: {
              userId: 'a598fd6f-b947-44e7-9f60-8ecbbde136a7'
          }
      }]);

            Assignee:
            Nick Brewer (Inactive)
            Reporter:
            Ben Mullard
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: