summaryrefslogtreecommitdiff
path: root/jstests/rename3.js
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-12-28 13:11:36 -0500
committerEliot Horowitz <eliot@10gen.com>2009-12-28 13:11:36 -0500
commit6df2dd965ee1ba576522096e67c2e1f773a669e9 (patch)
treee0f8cdd730cee3ebea5f3c6dc4cee5b8d2c8729d /jstests/rename3.js
parenta7f5b115d9a07ef7be54fb7e6bbc8d89da9d2f11 (diff)
downloadmongo-6df2dd965ee1ba576522096e67c2e1f773a669e9.tar.gz
forgot to commit test for SERVER-487
Diffstat (limited to 'jstests/rename3.js')
-rw-r--r--jstests/rename3.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/jstests/rename3.js b/jstests/rename3.js
new file mode 100644
index 00000000000..5e1005f8176
--- /dev/null
+++ b/jstests/rename3.js
@@ -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" );