Files
mongo/jstests/core/set6.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

21 lines
451 B
JavaScript

t = db.set6;
t.drop();
x = { _id : 1 , r : new DBRef( "foo" , new ObjectId() ) }
t.insert( x )
assert.eq( x , t.findOne() , "A" );
x.r.$id = new ObjectId()
t.update({}, { $set : { r : x.r } } );
assert.eq( x , t.findOne() , "B");
x.r2 = new DBRef( "foo2" , 5 )
t.update( {} , { $set : { "r2" : x.r2 } } );
assert.eq( x , t.findOne() , "C" )
x.r.$id = 2;
t.update( {} , { $set : { "r.$id" : 2 } } )
assert.eq( x.r.$id , t.findOne().r.$id , "D");