[SERVER-3213] group where initial contains a null value results in exception code 9010 Created: 07/Jun/11  Updated: 06/Dec/22  Resolved: 10/Mar/17

Status: Closed
Project: Core Server
Component/s: MapReduce
Affects Version/s: 1.8.1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Y. Wayne Huang Assignee: Backlog - Query Team (Inactive)
Resolution: Won't Fix Votes: 2
Labels: query
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

ubuntu 10.04


Assigned Teams:
Query
Operating System: ALL
Participants:

 Description   

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 ...
}



 Comments   
Comment by Tess Avitabile (Inactive) [ 10/Mar/17 ]

We're closing this ticket as "Won't Fix" since we have since deprecated the group command in 3.4.

Comment by Benjamin Flesch [ 06/Nov/12 ]

I'm still encountering this issue whilst running MongoDB 2.0.4 on an Ubuntu 12.04 server, although it has been reported some time ago. From my point of view, this seems like a low-hanging bug to fix. Can this please be fixed?

Generated at Thu Feb 08 03:02:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.