summaryrefslogtreecommitdiff
path: root/jstests/core/objid1.js
blob: f1a9fbe0fbda5351c2c60fcb3d77711106ba5ee2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
t = db.objid1;
t.drop();

b = new ObjectId();
assert( b.str , "A" );

a = new ObjectId( b.str );
assert.eq( a.str , b.str , "B" );

t.save( { a : a } );
assert( t.findOne().a.isObjectId , "C" );
assert.eq( a.str , t.findOne().a.str , "D" );

x = { a : new ObjectId() };
eval( " y = " + tojson( x ) );
assert.eq( x.a.str , y.a.str , "E" );