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

woCompare does not provide a total order over doubles and longs.

    • Minor Change
    • ALL

      Consider the following BSON objects, in shell notation.

      a = { x: NumberLong("72057594037927936") }
      b = { x: 72057594037927936.0 }
      c = { x: NumberLong("72057594037927937") } // c.x == a.x+1
      

      The following expressions all evaluate to true.

      bsonWoCompare(a, b) == bsonWoCompare(b, a) == 0
      bsonWoCompare(a, c) == -1
      bsonWoCompare(c, b) == 0
      

      So, a < c is true, a < b and b < a are false, and c < b and b < c are false. This lack of a total ordering means that you can construct an index on field x where document c occurs either before or after document a, due to the presence of documents like b.

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: