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

$group with $$ROOT returns error

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.4
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • None
    • Fully Compatible
    • ALL
    • 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 >
    • Query 2018-10-22

      $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 } }
      >
      

            Assignee:
            ian.boros@mongodb.com Ian Boros
            Reporter:
            robert@mongodb.com Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: