Files
mongo/jstests/objid6.js

15 lines
398 B
JavaScript
Raw Normal View History

o = new ObjectId();
assert(o.getTimestamp);
a = new ObjectId("4c17f616a707427266a2801a");
b = new ObjectId("4c17f616a707428966a2801c");
2010-06-15 21:28:26 -04:00
assert.eq(a.getTimestamp(), b.getTimestamp() , "A" );
2010-06-16 01:20:46 -07:00
x = Math.floor( (new Date()).getTime() / 1000 );
a = new ObjectId();
z = Math.floor( (new Date()).getTime() / 1000 );
y = a.getTimestamp().getTime() / 1000;
2010-06-15 21:28:26 -04:00
2010-06-16 01:20:46 -07:00
assert( x <= y , "B" );
assert( y <= z , "C" );