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

Allow constant integer in $group clause

    • Query Optimization

      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:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            renato.riccio@mongodb.com Renato Riccio
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: