Files
mongo/jstests/core/compare_timestamps.js
Geert Bosch e2443741a5 SERVER-15508: Have the shell accept all unsigned Timestamp values
Also rejects negative Timestamp time and increment arguments and canonicalizes types.
2015-10-30 23:39:50 -04:00

11 lines
397 B
JavaScript

// SERVER-21160: Check that timestamp comparisons are unsigned
(function() {
'use strict';
var t = db.compare_timestamps;
t.drop();
assert.writeOK(t.insert({a: new Timestamp(0xffffffff, 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 must compare unsigned");
}());