0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00
mongodb/jstests/objid6.js
2010-06-16 01:20:46 -07:00

15 lines
398 B
JavaScript

o = new ObjectId();
assert(o.getTimestamp);
a = new ObjectId("4c17f616a707427266a2801a");
b = new ObjectId("4c17f616a707428966a2801c");
assert.eq(a.getTimestamp(), b.getTimestamp() , "A" );
x = Math.floor( (new Date()).getTime() / 1000 );
a = new ObjectId();
z = Math.floor( (new Date()).getTime() / 1000 );
y = a.getTimestamp().getTime() / 1000;
assert( x <= y , "B" );
assert( y <= z , "C" );