0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 17:10:48 +01:00

forgot to commit test for SERVER-487

This commit is contained in:
Eliot Horowitz 2009-12-28 13:11:36 -05:00
parent a7f5b115d9
commit 6df2dd965e

25
jstests/rename3.js Normal file
View File

@ -0,0 +1,25 @@
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" );