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

temporary collection created by mapReduce returned Double instead of Int

    • Type: Icon: Question Question
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 1.6.5
    • Component/s: None
    • Labels:
      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?

            Assignee:
            Unassigned Unassigned
            Reporter:
            honnix Honnix Liang
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: