0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 01:21:03 +01:00
mongodb/jstests/objid1.js

17 lines
338 B
JavaScript
Raw Normal View History

2009-01-27 05:28:26 +01:00
t = db.objid1;
t.drop();
b = new ObjectId();
2009-05-14 22:35:43 +02:00
assert( b.str , "A" );
2009-01-27 05:28:26 +01:00
2009-05-14 22:35:43 +02:00
a = new ObjectId( b.str );
assert.eq( a.str , b.str , "B" );
2009-01-27 05:28:26 +01:00
t.save( { a : a } )
2009-05-14 22:35:43 +02:00
assert( t.findOne().a.isObjectId , "C" );
assert.eq( a.str , t.findOne().a.str , "D" );
2009-01-27 05:28:26 +01:00
x = { a : new ObjectId() };
eval( " y = " + tojson( x ) );
assert.eq( x.a.str , y.a.str , "E" );