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

group where initial contains a null value results in exception code 9010

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.8.1
    • Component/s: MapReduce
    • Labels:
    • Environment:
      ubuntu 10.04
    • Query
    • ALL

      if initial contains an attribute whose value is null, an exception will be thrown:

      Tue Jun 7 14:57:50 uncaught exception: group command failed:

      { "errmsg" : "exception: reduce invoke failed: JS Error: TypeError: invalid 'in' operand v shell/utils.js:218", "code" : 9010, "ok" : 0 }

      to reproduce:

      > db.mycoll.group({ key: { _id: true }, initial: { a: 0 }, reduce: function(o, p) { } })
      [ { "_id.hid" : 360, "a" : 0 } ]
      > db.mycoll.group({ key: { _id: true }, initial: { a: null }, reduce: function(o, p) { } })
      Tue Jun  7 14:57:50 uncaught exception: group command failed: {
      	"errmsg" : "exception: reduce invoke failed: JS Error: TypeError: invalid 'in' operand v shell/utils.js:218",
      	"code" : 9010,
      	"ok" : 0
      }
      

      it would be useful to be able to use an initial attribute with a null value for computing min/max values where the range is not known:

      function(o, p) {
          if (p.min == null || o.value < p.min) { p.min = o.value; }
          if (p.max == null || o.value > p.max) { p.max = o.value; }
          ... other reduce computations ...
      }
      

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            wayne530 Y. Wayne Huang
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: