Files
mongo/jstests/core/objid4.js
Siyuan Zhou 3660343e0b SERVER-12127 migrate js tests to jscore suite when not related to writes
Migrate js tests starting from j-z.
Include SERVER-12920 Update use_power_of_2.js

Signed-off-by: Matt Kangas <matt.kangas@mongodb.com>
2014-03-03 22:54:10 -05:00

17 lines
370 B
JavaScript

o = new ObjectId();
assert( o.str );
a = new ObjectId( o.str );
assert.eq( o.str , a.str );
assert.eq( a.str , a.str.toString() )
b = ObjectId( o.str );
assert.eq( o.str , b.str );
assert.eq( b.str , b.str.toString() )
assert.throws( function(z){ return new ObjectId( "a" ); } );
assert.throws( function(z){ return new ObjectId( "12345678901234567890123z" ); } );