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

Allow constant integer in $group clause

    XMLWordPrintable

    Details

      Description

      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

        Attachments

          Activity

            People

            Assignee:
            backlog-query-optimization Backlog - Query Optimization
            Reporter:
            renato.riccio Renato Riccio
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated: