Sharded aggregation can't handle multiple $group commands

XMLWordPrintableJSON

    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The current implementation assumes that when running in mongos it should be merging results from the shards. While this applies to the first $group, it doesn't apply to any others.

      mongos> for (var i=0; i<100;i++) db.foo.insert({_id:i, i:i%10})
      mongos> db.foo.aggregate({$group:{_id:'$_id', i:{$first:'$i'}}},{$group:{_id:'$_id', i:{$avg:'$i'}}})
      {
      	"errmsg" : "exception: assertion src/mongo/db/pipeline/accumulator_avg.cpp:43",
      	"code" : 0,
      	"ok" : 0
      }
      

      Note that both stages in the pipeline work by themselves and should return each document unmodified. Also, the combined aggregation works when running on a single server.

            Assignee:
            Matt Dannenberg (Inactive)
            Reporter:
            Mathias Stearn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: