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

$group with $$ROOT returns error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.1.4
    • Component/s: Aggregation Framework
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      Repro using 4.1.3-231-ga106c80c19:

      > db.version()
      4.1.3-231-ga106c80c19
      > db.test.find()
      { "_id" : 1, "x" : 1 }
      { "_id" : 2, "x" : 2 }
      > db.test.aggregate([ { $group : { _id : "$$ROOT" } } ])
      2018-10-03T14:24:20.951-0400 E QUERY    [js] Error: command failed: {
              "ok" : 0,
              "errmsg" : "FieldPath::tail() called on single element path",
              "code" : 16409,
              "codeName" : "Location16409"
      } : aggregate failed :
      _getErrorWithCode@src/mongo/shell/utils.js:25:13
      doassert@src/mongo/shell/assert.js:18:14
      _assertCommandWorked@src/mongo/shell/assert.js:534:17
      assert.commandWorked@src/mongo/shell/assert.js:618:16
      DB.prototype._runAggregate@src/mongo/shell/db.js:260:9
      DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1056:12
      @(shell):1:1
      >
      

      Show
      Repro using 4.1.3-231-ga106c80c19: > db.version() 4.1 . 3 - 231 -ga106c80c19 > db.test.find() { "_id" : 1 , "x" : 1 } { "_id" : 2 , "x" : 2 } > db.test.aggregate([ { $group : { _id : "$$ROOT" } } ]) 2018 - 10 -03T14: 24 : 20.951 - 0400 E QUERY [js] Error: command failed: { "ok" : 0 , "errmsg" : "FieldPath::tail() called on single element path" , "code" : 16409 , "codeName" : "Location16409" } : aggregate failed : _getErrorWithCode @src /mongo/shell/utils.js: 25 : 13 doassert @src /mongo/shell/ assert .js: 18 : 14 _assertCommandWorked @src /mongo/shell/ assert .js: 534 : 17 assert .commandWorked @src /mongo/shell/ assert .js: 618 : 16 DB.prototype._runAggregate @src /mongo/shell/db.js: 260 : 9 DBCollection.prototype.aggregate @src /mongo/shell/collection.js: 1056 : 12 @(shell): 1 : 1 >
    • Sprint:
      Query 2018-10-22

      Description

      $group with $$ROOT starting failing recently when running the C# driver tests.

      Not sure when exactly it started failing, but it can be reproduced using 4.1.3-231-ga106c80c19.

      Here's a repro showing it working in 4.0.2:

      > db.version()
      4.0.2
      > db.test.find()
      { "_id" : 1, "x" : 1 }
      { "_id" : 2, "x" : 2 }
      > db.test.aggregate([ { $group : { _id : "$$ROOT" } } ])
      { "_id" : { "_id" : 2, "x" : 2 } }
      { "_id" : { "_id" : 1, "x" : 1 } }
      >
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: