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

db.js trying to reassign const

    • Type: Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.0.0
    • Component/s: Shell
    • Labels:
      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 Nick Brewer
            Reporter:
            benmullard Ben Mullard
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: