64 bit signed int issues in the mongo shell

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.6.6
    • Component/s: Shell
    • None
    • ALL
    • Hide
      db.test.save({value: 9223372036854775807})
      db.test.find()
      db.test.update({_id: "whatever was returned in find"}, {$inc: {value: 1}})
      
      Show
      db.test.save({value: 9223372036854775807}) db.test.find() db.test.update({_id: "whatever was returned in find" }, {$inc: {value: 1}})
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      So I was curious to see how auto increment would react to a field in mongo with the max 64 bit signed int value (9223372036854775807) and was surprised to find it was capping the value to 9223372036854776000. With a bit of research, I found this is the same behavior in Javascript. The two things that are concerning though were A. $inc past the 9223372036854776000 value does absolutely nothing. No error. Nada. The value remains untouched. Decrementing the value also does nothing. However B. the most alarming thing was that a query with $gt :

      { 9223372036854775999 }

      returns nothing. Dropping this value down to 9223372036854775800, still nothing. I didn't test to see exactly where it begins to work again, but I found 9223372036854775100 did work and returned the original document.

            Assignee:
            Unassigned
            Reporter:
            Jason Welch
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: