-
Type: Question
-
Resolution: Done
-
Priority: Minor - P4
-
None
-
Affects Version/s: 1.6.5
-
Component/s: None
-
None
-
Environment:Mac OS X 64bit, mongoDB-1.6.5 64bit, mongodb-java-driver-2.4
Not sure whether it is a bug, so just fire a question.
I have following map/reduce functions defined:
m = function()
{ emit("totalClickCount", this.clickCount); }r = function(key, values)
{ return Array.sum(values); }If I run everything in mongodb console, I can get result as I expected:
{ "_id" : "totalClickCount", "value" : 2 }, here value is an integer; but if I use mongodb-java-driver to do exactly the same thing, it returns double instead of integer for "value". Also, I tried to query the temporary collection directly in mongodb console, and it is integer as well.
I tried to debug, and saw that for returned BSON stream, data type was "NUMBER" which means a floating point according to BSON's spec, so seems that mongodb-java-driver is correct. But why does server return a double type?