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

26 lines
583 B
JavaScript

a = db.rename3a
b = db.rename3b
a.drop();
b.drop()
a.save( { x : 1 } );
b.save( { x : 2 } );
assert.eq( 1 , a.findOne().x , "before 1a" );
assert.eq( 2 , b.findOne().x , "before 2a" );
res = b.renameCollection( a._shortName );
assert.eq( 0 , res.ok , "should fail: " + tojson( res ) );
assert.eq( 1 , a.findOne().x , "before 1b" );
assert.eq( 2 , b.findOne().x , "before 2b" );
res = b.renameCollection( a._shortName , true )
assert.eq( 1 , res.ok , "should succeed:" + tojson( res ) );
assert.eq( 2 , a.findOne().x , "after 1" );
assert.isnull( b.findOne() , "after 2" );