[SERVER-973] 64bit integers in group Created: 06/Apr/10  Updated: 12/Jul/16  Resolved: 08/Jul/10

Status: Closed
Project: Core Server
Component/s: JavaScript
Affects Version/s: 1.4.0
Fix Version/s: 1.5.5

Type: Bug Priority: Major - P3
Reporter: Sergej Jure?ko Assignee: Aaron Staple
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

Seeding a group call with a 64bit integer will produce unwanted results. Instead of summing on an integer field, it will concatenate strings.

Example
Collection:

{ch : "channelname", size : SizeOfFile, ....some other not relevant data}

This will work in mongo console, because size is seeded with a 32bit integer or a double
db.file.group({key :

{ch : true}

, cond :

{ch : "channelname"}

, reduce : function(doc,out)

{out.size += doc.size;}

, initial : {size : 0}})

If a driver uses a 64 bit integer, the reduce function is going to go like this (printjson output):

{ "ch" : "eph.eph.main", "size" :

{ "floatApprox" : 0 }

}

{ "ch" : "eph.eph.main", "size" : "[object Object]23810924" } { "ch" : "eph.eph.main", "size" : "[object Object]2381092418479807" } { "ch" : "eph.eph.main", "size" : "[object Object]23810924184798075661612" }

{
"ch" : "eph.eph.main",
"size" : "[object Object]238109241847980756616124350139"
}
{
"ch" : "eph.eph.main",
"size" : "[object Object]2381092418479807566161243501392645007"
}
{
"ch" : "eph.eph.main",
"size" : "[object Object]23810924184798075661612435013926450074783518"
}
{
"ch" : "eph.eph.main",
"size" : "[object Object]2381092418479807566161243501392645007478351815558296"
}
.....



 Comments   
Comment by auto [ 08/Jul/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-973 test
http://github.com/mongodb/mongo/commit/31c9bf6b06eefd89a86507f2b1046c39f2c7e30a

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