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

64bit integers in group

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.5.5
    • Affects Version/s: 1.4.0
    • Component/s: JavaScript
    • None

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

            Assignee:
            aaron Aaron Staple
            Reporter:
            sergej.jurecko@gmail.com Sergej Jure?ko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: