Allow constant integer in $group clause

XMLWordPrintableJSON

    • Query Optimization
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Currently, $group does not allow to have a constant integer in a group clause, on the other hand, it supports strings. For example

      db.foo.aggregate([{$group:{_id: {a:"$a", d:1},c: {$sum:"$c"}}}])
      assert: command failed: {
          "ok" : 0,
          "errmsg" : "$group does not support inclusion-style expressions",
          "code" : 17390,
          "codeName" : "Location17390"
      } : aggregate failed
      

      If set d as a string we don't get any error

      db.foo.aggregate([{$group:{_id: {a:"$a", d:"1"},c: {$sum:"$c"}}}])
      

      In order to be consistent group should support also integer inside _id

              Assignee:
              [DO NOT USE] Backlog - Query Optimization
              Reporter:
              Renato Riccio
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: