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

Timestamp comparison is not unsigned since 3.1.x

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 3.2.0-rc2
    • 3.1.3, 3.2.0-rc0, 3.2.0-rc1
    • Querying
    • None
    • Fully Compatible
    • ALL
    • Hide

      // Check that timestamp comparisons are unsigned
      (function() {
          'use strict';
          var t = db.compare_timestamps;
          t.drop();
          assert.writeOK(t.insert({a: new Timestamp(-2, 3), b:"non-zero"}));
          assert.writeOK(t.insert({a: new Timestamp(0, 0), b:"zero"}));
          assert.eq(t.find().sort({a:1}).limit(1).next().b, "zero", "timestamp comparison must be unsigned");
      }());
      

      Show
      // Check that timestamp comparisons are unsigned ( function () { 'use strict' ; var t = db.compare_timestamps; t.drop(); assert.writeOK(t.insert({a: new Timestamp(-2, 3), b: "non-zero" })); assert.writeOK(t.insert({a: new Timestamp(0, 0), b: "zero" })); assert.eq(t.find().sort({a:1}).limit(1).next().b, "zero" , "timestamp comparison must be unsigned" ); }());
    • QuInt B (11/02/15)

    Description

      When the date_t type was made to contain the unsigned count of millis, Timestamp inadvertently changed to use signed comparison though it is documented and intended to be unsigned.

      Attachments

        Activity

          People

            geert.bosch@mongodb.com Geert Bosch
            geert.bosch@mongodb.com Geert Bosch
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: