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

NumberLong(max_of_int64) returns wrong result in mongo shell

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Shell
    • None
    • Environment:
      Linux 3.5.0-18-generic #29-Ubuntu SMP x86_64
      MongoDB 2.2.2
    • ALL
    • Hide

      1. Open Mongo shell.
      2. Type: NumberLong(9223372036854775807).
      3. If you got answer: NumberLong(9223372036854775807) close shell and go to step 1.
      4. More frequently you'll get answer: NumberLong("-9223372036854775808"). I think this is wrong.
      My example:
      MongoDB shell version: 2.2.2
      connecting to: dataproviders
      > NumberLong(9223372036854775807)
      NumberLong("-9223372036854775808")

      Show
      1. Open Mongo shell. 2. Type: NumberLong(9223372036854775807). 3. If you got answer: NumberLong(9223372036854775807) close shell and go to step 1. 4. More frequently you'll get answer: NumberLong("-9223372036854775808"). I think this is wrong. My example: MongoDB shell version: 2.2.2 connecting to: dataproviders > NumberLong(9223372036854775807) NumberLong("-9223372036854775808")

      Assume that max value of 64-bit integer id 2^63-1 = 9223372036854775807
      But sometimes in mongo shell we got wrong results from NumberLong(9223372036854775807):

      MongoDB shell version: 2.2.2
      connecting to: dataproviders
      > NumberLong(9223372036854775807)
      NumberLong("-9223372036854775808")
      

            Assignee:
            geert.bosch@mongodb.com Geert Bosch
            Reporter:
            happysoft Vadim Voitsiakh
            Votes:
            1 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: